Use this when creating or securing registry keys.
Registry Keys
Registry keys are containers in the registry tree, like folders, addressed by paths such as HKLM\SYSTEM\CurrentControlSet\Services. Keys hold values and subkeys and have their own permissions.
1. Identify the key path and value name (and type: REG_SZ, DWORD …).
2. Back up: reg export <key> backup.reg.
3. Read with Get-ItemProperty; check permissions with Get-Acl.
4. Change via GPO/tool if possible; otherwise Set-ItemProperty.
5. Confirm effect; restore from the .reg if wrong.
hive file loaded → root key → subkeys → values with type and data → consumer reads them
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Deleting keys recursively without export.
- Wrong permissions after manual edits.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Keys are addressed by path.
- Keys can contain subkeys.
- Keys have ACLs and an owner.
Get-ItemProperty 'HKLM:\<path>'— read valuesreg query <key> /s— query in CMDreg export <key> <file>.reg— back up a keyGet-Acl 'HKLM:\<path>' | fl— key permissionsGet-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Services'— example: services keys
ReferenceWhy it matters1 section · depth on demand
What it is
A key is a container in the registry path, such as HKLM\SOFTWARE\Vendor\App. It can hold subkeys and values and has its own ACL, which is inherited by subkeys by default. Software typically reads settings from fixed key paths, so a misspelt key or the wrong 32/64-bit view means the setting is silently ignored.
ReferenceImportant terms & boundaries2 sections · depth on demand
Commands
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
reg add HKLM\SOFTWARE\Vendor\App /v Enabled /t REG_DWORD /d 1 /f
New-Item -Path HKLM:\SOFTWARE\Vendor\App -Force
Documented example, not captured output.
In depth
Working with registry keys in PowerShell (registry provider):
Test-Path 'HKLM:\SOFTWARE\CorpApp'
New-Item -Path 'HKLM:\SOFTWARE\CorpApp' -Force
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Select DisplayName,DisplayVersion,Publisher
Remove-Item 'HKCU:\Software\OldApp' -Recurse
Keys have their own ACLs (Get-Acl HKLM:\SOFTWARE\CorpApp); some system keys are owned by TrustedInstaller and deliberately not writable by administrators.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Registry → Registry Keys. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry · confidence 94%