In the previous tip we explained how to convert a PS-built path format into a real path. An example is presented here. This code recursively obtains from HKEY_CURRENT_USER all the keys that contain the "PowerShell" affix (a simple substitution query affix will get anything you want to query)
Copy Code code as follows:
Get-childitem-path hkcu:\-include *powershell*-recurse-erroraction silentlycontinue| Select-object-property *path* | Out-gridview
This code prints out all the attributes that contain the "path", and you will see that there are two attributes in the registry containing the keywords: Pspath and psparentpath all use the PS built-in path format.
To simply remove the path in the registry to meet your query criteria, you try this:
Copy Code code as follows:
Get-childitem-path hkcu:\-include *powershell*-recurse-erroraction silentlycontinue| Foreach-object {Convert-path-path $_. Pspath}
Supports all PS versions