PowerShell Script: Use PowerShell to Query for Registry Keys

goay xuan hui
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:

  1. HKEY_LOCAL_MACHINE (HKLM)
  2. HKEY_CURRENT_CONFIG (HKCC)
  3. HKEY_CLASSES_ROOT (HKCR)
  4. HKEY_USERS (HKU)
  5. HKEY_CURRENT_USER (HKCU)

PowerShell queries

  • To read registry names and values:
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion

--

--

goay xuan hui

A food lover, a cyber security enthusiast, a musician and a traveller, so you will see a mix of different contents in my blog. ☺️