title: More succinct way of getting a registry value as a string than (Get-ItemProperty $key $valueName)._VALUENAME_?
body: <p>The method for getting a value in a registry key from PowerShell is:</p>
  
  <pre><code>Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion CommonFilesDir
  </code></pre>
  
  <p>However, that command returns some extra properties I don't usually want:</p>
  
  <pre><code>CommonFilesDir : C:\Program Files\Common Files
  PSPath         : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
  PSParentPath   : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
  PSChildName    : CurrentVersion
  PSDrive        : HKLM
  PSProvider     : Microsoft.PowerShell.Core\Registry
  </code></pre>
  
  <p>I just want the actual value, a string in this case. To do that I have to use the more verbose:</p>
  
  <pre><code>$commonFilesDir = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion CommonFilesDir).CommonFilesDir
  </code></pre>
  
  <p>Other than writing my own alias, is there a way of not writing the property name twice and getting a <em>string</em>?</p>
  
  <p>I could run the following command, but it returns a PSObject:</p>
  
  <pre><code>Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion | Select CommonFilesDir
  </code></pre>