October 27, 2011 at 7:03 PM
One of the most potentially useful features of the AD tools provided by Microsoft is the AD PowerShell Provider. A Provider in PowerShell allows a user to interact with a data structure similarly to how they would interact with a file system. You can change directories, list items, create new items, and delete items. This is a really good model for any kind of hierarchical data. AD is a great example. I like to use PowerShell providers to find and navigate through data very quickly.
The problem I have with the AD Provider is the names that are used when you navigate into Active Directory. In this case, a picture is worth a thousand words.
What do you mean the path doesn’t exist? According to the output of my last ls command, I should be able to cd into windev, configuration, and 3 others. It turns out you don’t use the name of the “Name” property. You have to cd into the “Distinguished Name”
To me, that is very unintuitive and does not align well with the PowerShell mantra, “Think”, “Type”, “Get.” Well in the Windows 8 Developer Preview Server, you can address this issue. The default drive AD: still exists and behaves in the same way, but it doesn’t have to stay that way.
You can remove the AD PSDrive and create your own new one. The trick here is to use the –FormatType switch with the parameter “canonical.” This will change how the drive is set up and what names the provider binds to
Now we can navigate through AD much more easily.