Windows PowerShell Home
Problem When PowerShell Drive's Root has Same Name as Object Within Drive
4/5/2013 1:15:31 PM
User(s) can reproduce this bug
If your current location is within a PowerShell drive and in this location there is an object whose name starts with the "Root" name of the PowerShell provider you can get an error when trying to access it. PowerShell will state that the object does not exist and in the error you can see that PowerShell parsed the root name out of the object name so its not actually looking for the correct path. This seems to only be possible using PowerShell drives that support a root that does not contain special characters such as the "Registry Provider" or a custom provider.
How often does this happen?
Have you seen this problem before in this product?
I do not know if this issue existed previously
In order to reproduce the issue its necessary to make use of the "Registry" provider because it's Root does not contain special characters.
1.) Open regedit.exe so we can add a new Key for testing.
2.) Expand "HKEY_CURRENT_USER". I use this because this is the root of the "HKCU" drive in PowerShell which is important to this test.
3.) Right-Click the "HKEY_CURRENT_USER" Folder and add a new Key called "HKEY_CURRENT_USERTEST"
4.) Open PowerShell and do:
Note that you will get this error:
GCI : Cannot find path 'HKEY_CURRENT_USER\TEST' because it does not exist.
I would expect not to get an error. PowerShell is incorrectly splitting the path into two parts by looking for "HKEY_CURRENT_USER\TEST" instead of "HKEY_CURRENT_USERTEST"
to post a comment.
Please enter a comment.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft