Powershell

How do I Get the Value of a Registry Key and ONLY the Value Using PowerShell

PowerShell is a Window’s most powerful tool used to perform administrative tasks. It is even utilized to modify the “Registry Editor” keys. A Registry Key is similar to a file or folder path, but it can be found only inside the Registry Editor. Registry keys also contain registry values. These values can be retrieved in PowerShell using some specific commands. Moreover, it is highly recommended to back up registry keys before making any changes.

This post will illustrate an in-depth guide for getting the registry key values with the help of PowerShell.

How to Get/Retrieve the Registry Key’s Value and Only the Value by Utilizing PowerShell?

These approaches can be considered to get the registry key values:

Method 1: Get/Retrieve the Registry Key’s Value and Only the Value by Utilizing “Get-ItemProperty” Command

The “Get-ItemProperty” is a command in PowerShell that is utilized to get the registry entries or values in the readable format in the console. It is specifically used to retrieve the specified registry in PowerShell.

Example

This example will retrieve only one value in the “AU” directory using the “Get-ItemProperty”:

> Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"

As it can be seen that the one value has been selected and displayed in the PowerShell console.

Method 2: Get the Registry Key’s Value and Only the Value by Utilizing “Get-ItemPropertyValue” Command

The “Get-ItemPropertyValue” command in PowerShell version 5 was introduced. It is used to get the species registry query in the shortest form. This cmdlet requires only two parameters, the registry’s path, and the registry’s key.

Example

Now, we will get the registry key’s values in the short form using the “Get-ItemPropertyValue” command:

> Get-ItemPropertyValue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion" "ProgramFilesPath"

The registry key values have been displayed in the output.

Conclusion

To get/retrieve the registry keys by utilizing PowerShell, multiple methods can be utilized. These methods include “Get-ItemProperty” and “Get-ItemPropertyValue”. Both of the methods retrieve the value of a registry key using PowerShell. This post has illustrated a complete procedure to resolve the mentioned query.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.