QuickTip: Additional PowerShell Registry drives
Windows PowerShell provides access to the system registry via two PowerShell drives: HKLM and HKCU, which maps to the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER registry hives respectively.
PS > Get-PSDrive -PSProvider Registry
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
To add registry drives for other hives like HKEY_USERS,HKEY_CLASSES_ROOT etc, we can use the New-PSDrive cmdlet with the provider path of each hive (the $null assignment is used to suppress the output of each New-PSDrive command).
$null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
$null = New-PSDrive -Name HKCR -PSProvider Registry -Root Registry::HKEY_CLASSES_ROOT
$null = New-PSDrive -Name HKCC -PSProvider Registry -Root Registry::HKEY_CURRENT_CONFIG
PS > Get-PSDrive -PSProvider Registry
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
HKCC Registry HKEY_CURRENT_CONFIG
HKCR Registry HKEY_CLASSES_ROOT
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
HKU Registry HKEY_USERS
You won't be able to access the new registry drives after you exit a current PowerShell session. To make them persistent add the commands to your PowerShell profile.