April 2nd, 2015

PowerTip: Use PowerShell to Read Registry Key Property Value

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to read a registry key property value.

Hey, Scripting Guy! Question How can I use Windows PowerShell to read a registry key property value so I can find the version of a particular software package?

Hey, Scripting Guy! Answer Use the Get-ItemProperty cmdlet, for example:

Get-ItemProperty -Path HKCU:\Software\ScriptingGuys\Scripts -Name version

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Chris Quinn

    This may resturn better results depending on the property
    Get-ItemPropertyProperty -Path HKCU:\Software\ScriptingGuys\Scripts -Name version
    As an example I was looking for a correct Windows Build number which at first should be 
    [System.Environment]::OSVersion.Version
    The issue I had was with Windows returning a 0 for revision on  the Revision property when I knew I had installed service packs that should have updated the build. 
    In my case I found that the Registry Key "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" Ccontained much more information...

    Read more
  • Chris Quinn

    This may resturn better results depending on the property
    Get-ItemPropertyProperty -Path HKCU:\Software\ScriptingGuys\Scripts -Name version
    As an example I was looking for a correct Windows Build number which at first should be 
    [System.Environment]::OSVersion.Version
    The issue I had was with Windows returning a 0 for revision on  the Revision property when I knew I had installed service packs that should have updated the build. 
    In my case I found that the Registry Key "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" Ccontained much more information...

    Read more