How to retrieve windows registry keys and values using PowerShell?



To browse through the registry in PowerShell, we can use the Get-ChildItem command. For example to get all keys from the path HKLM:\Hardware we can use the below command.

Get-ChildItem HKLM:\HARDWARE

Or you can set the location and use the dir (get-ChildItem or ls) command to browse the path.

Example

PS C:\> Set-Location HKLM:\HARDWARE PS HKLM:\HARDWARE> dir

Output

Hive: HKEY_LOCAL_MACHINE\HARDWARE Name    Property ----    -------- ACPI DESCRIPTION DEVICEMAP RESOURCEMAP

To get the properties of the key, use the Get-ItemProperty command.

Example

Set-Location 'HKLM:\SOFTWARE\VMware, Inc.' Get-ItemProperty '.\VMware Drivers'

Output

efifw.status   : 1|1.1.0.0.0.1|oem2.inf vmxnet3.status : 1|1.1.8.16.0.1|oem3.inf pvscsi.status   : 1|1.1.3.15.0.1|oem4.inf vmusbmouse.status : 1|1.12.5.10.0.1|oem5.inf vmmouse.status : 1|1.12.5.10.0.1|oem6.inf
Updated on: 2021-02-08T07:31:24+05:30

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements