Accessing Registry Keys that contain a slash
Lee Holmes answered a question recently that I had not really thought of. In PowerShell V2 this is fixed, but in V1 you will have to work around the issue.
The problem is when the key name contains a slash, the provider for the registry will treat this as a separator. So when you try to use any of the commandlets to get values or keys in that location, it will return a message that the path can’t be found.
Lee mentioned that a way to work around this is to actually save the key to a variable then access the path using the methods on the object. This is of issue with the MIME type registry entries.
http://support.microsoft.com/kb/165072
An example below…
new-psdrive –name HKCR –psprovider registry –root hkey_classes_root ; set-location HKCR:\mime\database\”content type” #should show nothing get-childitem $contenttype = get-item . #should show all keys $contenttype.getsubkeynames(); #next command gets the application/hta key $htakey = $contenttype.opensubkey(“application/hta”); #next command get the values available $htakey.getvaluenames(); #gets “extension” value $htakey.getvalue(“Extension”); |