Finding and Dumping Registry Key Paths

by Jul 31, 2014

All PowerShell versions

In a previous tip we illustrated how to convert an internal PowerShell path format to a real path. Here is a use case. This code recursively searches through HKEY_CURRENT_USER and dumps all Registry keys that contain the word “powershell” (simply replace the search word with anything else that you may be looking for):

Get-ChildItem -Path HKCU:\ -Include *PowerShell* -Recurse -ErrorAction SilentlyContinue |
  Select-Object -Property *Path* |
  Out-GridView 

The code outputs all properties that have “Path” in it, and as you will see, Registry keys have two properties that contain the key location: PSPath and PSParentPath. Both use the internal PowerShell path format.

To simply dump the Registry paths for all keys meeting your search criteria, try this:

Get-ChildItem -Path HKCU:\ -Include *PowerShell* -Recurse -ErrorAction SilentlyContinue |
  ForEach-Object {
    Convert-Path -Path $_.PSPath
  }

Twitter This Tip! ReTweet this Tip!