Help with new-psdrive of Active Directory on Windows 7

Topics: User Forum
Aug 14, 2009 at 5:44 PM

Hello gentlemen, I'm attempting to make a psdrive of my active directory on Windows 7 but I am unsure whether something is broken or if I'm not doing it right. I can't find where the drive is being mounted, but apparently the drive is being created. Attempting to run "cd domain:" results in directory not found.


PS C:\Users\user> new-psdrive -Name "domain" -PSProvider DirectoryServices -Credential domain\domainadminuser -root "domaincontroller"
Name           Used (GB)     Free (GB) Provider      Root
----               ---------        ---------   --------         ----
domain                                           DirectoryS... domain:


PS C:\Users\user> get-psdrive
Name           Used (GB)     Free (GB) Provider      Root
----           ---------     --------- --------      ----
Alias                                  Alias
C                  34.89        114.02 FileSystem    C:\
cert                                   Certificate   \
D                                      FileSystem    D:\
Env                                    Environment
Feed                                   FeedStore
Function                               Function
Gac                                    AssemblyCache Gac
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE
Pscx                                   PscxSettings
domain                                   DirectoryS... domain:
Variable                               Variable
WSMan                                  WSMan
Z                 545.41        478.47 FileSystem    Z:\



Aug 21, 2009 at 4:54 PM

Dumb question, but you're not really using -root "domaincontroller" and invoking -credential like that?  I would presume you did -Credential (get-credential) and provided a proper LDAP/x500 path to the OU in -Root.

If you're still having problems, please try this:

ps> cd domain:
(error appears here)
ps> $error[0].tostring()
(error message displayed here - please paste this in as a reply)
ps> $error[0].exception.tostring()
(this message too please)


Aug 21, 2009 at 6:21 PM
Edited Aug 21, 2009 at 6:22 PM

Yes, I was not using the LDAP path for root I was using the hostname of a DC. How uninformed I was, my apologies for making my post so unintuitive. This is what works now:

ps> new-psdrive -Name "myaddrivehandle" -PSProvider DirectoryServices -Credential domain\domainadminuser -root "DC=ad,DC=asdf,DC=com"

ps> cd myaddrivehandle:


Much obliged!