title: Store a cmdlet's result value in a variable in Powershell
body: <p>I would like to run a cmdlet and store the result's <strong>value</strong> in a variable.</p>
  
  <p>For example</p>
  
  <pre><code>C:\PS&gt;Get-WSManInstance -enumerate wmicimv2/win32_process | select Priority
  </code></pre>
  
  <p>It lists priorities with a header. The first one for example:</p>
  
  <pre><code>Priority
  --------
  8
  </code></pre>
  
  <p>How can i store them in a variable? I've tried:</p>
  
  <pre><code>$var=Get-WSManInstance -enumerate wmicimv2/win32_process | select Priority
  </code></pre>
  
  <p>Now the variable is: <code>@{Priority=8}</code> and I wanted it to be <code>8</code>.</p>
  
  <p>Question 2:</p>
  
  <p>Can I store two variables with one cmdlet? I mean store it after the pipeline.</p>
  
  <pre><code>C:\PS&gt;Get-WSManInstance -enumerate wmicimv2/win32_process | select Priority, ProcessID
  </code></pre>
  
  <p>I would like to avoid this:</p>
  
  <pre><code>$prio=Get-WSManInstance -enumerate wmicimv2/win32_process | select Priority
  $pid=Get-WSManInstance -enumerate wmicimv2/win32_process | select ProcessID
  </code></pre>