Registry values are the files that contain the properties and settings of the operating system or an installed application. They store individual/global configurations of applications during startup and login. These values come in different formats and can have values in string, hexadecimal or binary.

To get a desired registry key value in PowerShell, users will need to enter syntax called commandlets (cmdlets). These are lightweight commands built in .NET Framework that perform a specific task or form a part of ascript in Windows PowerShell.

Methods to Get Registry Key Value in Powershell

These ‘hives’ contain further sub-directories called Keys which may also contain their own subkeys. These keys are the folders that hold the values and properties of the system/application.

test-path-registry-1024x245

Before we learn to get registry values, it is beneficial to know how to generate and test the path of the registry directory in PowerShell. To do this, you may validate the pathkey using theTest-pathcommandlet.

This commandlet then returns a ‘True’ value if the key/path exists and returns a ‘False’ value if the path or key does not exist.

TheReg Querycmdlet returns a list of keys or subkey contents. This cmdlet shows the contents that are under the next level or tier of the directory. This cmdlet is useful as it shows all the content inside the specified registry path or directory.

Powershell-Reg-Query

In this example, the query will display the registry entries that are under the “Run” sub key.

The method to get the desired registry key value in PowerShell is by using theGet-Itemcmdlets. This retrieves information from directories specified by the user in PowerShell. There are mainly two methods to get the key value from theGet-Itemcmdlet.

By using these cmdlets, users can get the desired registry key value in PowerShell.

get-item-property-value

Get-ItemPropertyValue

Another method to retrieve desired registry value is by using theGet-ItemPropertyValuecmdlet. Thiscmdlet gets the values or properties of the specified itemsafter executing it.

The syntax to get the registry value:

After entering the syntax, press the Enter key and then the specified registry key contents will be displayed on PowerShell.

get-child-item

Another method to obtain the required registry value in PowerShell is by using theGet-ChildItemcmdlet. This cmdlet enumerates and then displays all the listed items from the specified directory. The cmdlet however, does not return anything if a directory is empty.

childitem-exclude-filter-1024x361