Enumerating Registry Keys
To enumerate all subkeys in a Registry key, you might be using a line like this:
PS> Dir HKLM:\SOFTWARE\Microsoft\
Microsoft.PowerShell.Core\Regi
Microsoft.PowerShell.Core\Regi
(...)
It will return the PowerShell-style path including the provider name, not just the Registry path. If you used the -Name parameter, on the other hand, you just get the subkey names and no path at all:
PS> Dir HKLM:\SOFTWARE\Microsoft\
AddressBook
Connection Manager
(...)
The easiest way to get the true Registry path is Resolve-Path:
PS> Resolve-Path HKLM:\SOFTWARE\Microsoft\Windo
Path
----
HKLM:\SOFTWARE\Microsoft\
HKLM:\SOFTWARE\Microsoft\
(...)
The resulting paths still use PowerShell drives. To get the native Registry paths, try this:
PS> Resolve-Path HKLM:\SOFTWARE\Microsoft\Windo
HKEY_LOCAL_MACHINE\SOFTWARE\
HKEY_LOCAL_MACHINE\SOFTWARE\
(...)
Thanks
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.