PowerShell Script: Use PowerShell to Query for Registry Keys
Apr 18, 2021
Understand Windows registry
Before we go into the query section, let us first understand the structure of Windows registry. Windows registry has five root keys:
- HKEY_LOCAL_MACHINE (HKLM)
- HKEY_CURRENT_CONFIG (HKCC)
- HKEY_CLASSES_ROOT (HKCR)
- HKEY_USERS (HKU)
- HKEY_CURRENT_USER (HKCU)
PowerShell queries
- To read registry names and values:
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion