Skip to main content

PowerShell: Adding Registry Hives

Get-PSDrive -PSProvider Registry
Name           Used (GB)     Free (GB) Provider      Root                                                                                                CurrentLocation
----           ---------     --------- --------      ----                                                                                                ---------------
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE

The default setup with the Registry provider in PowerShell is to map the HKCU and the HKLM hives. However, on the occasion that you want to interact with other registry hives in PowerShell, you'll need to map them, which is a straightforward task.



Using the HKEY_CLASSES_ROOT hive as an example, you can run this command to map said hive.

New-PSDrive -PSProvider Registry -Root HKEY_CLASSES_ROOT -Name HKCR

And, now you can interact with this hive as a typical file system drive.

cd HKCR:\