Datasheet
UNDERSTAND HOW POWERSHELL AND ACTIVE DIRECTORY WORK TOGETHER 47
Administering
Service Delivery
PART I
Use the Active Directory Drive
In addition to providing the Active Directory cmdlets, the Active Directory module
for PowerShell also provides a new drive called the AD drive. With the AD drive,
you can navigate Active Directory in a manner similar to the way you would navi-
gate the le system on your hard drive. To use the AD drive, rst make sure the
Active Directory module is loaded, and then run the following command:
PS C:\> cd AD:
is changes the working context of your PowerShell session to the Active
Directory drive. e default location is the
rootDSE
, which is the top-level
entry in the domain controller itself. A listing of the objects in the default path
is as follows:
PS AD:\> dir
Name ObjectClass DistinguishedName
---- ----------- -----------------
contoso domainDNS DC=contoso,DC=com
Configuration configuration CN=Configuration,DC=contoso,DC=com
Schema dMD CN=Schema,CN=Configuration,DC=contoso,DC=com
DomainDnsZones domainDNS DC=DomainDnsZones,DC=contoso,DC=com
ForestDnsZones domainDNS DC=ForestDnsZones,DC=contoso,DC=com
From here, you can change the path just as you would change directories in the le-
system. To do so, you can use the
cd
command followed by the distinguished name
of the path. To navigate to the
contoso.com
domain, use the following command:
PS AD:\> cd “dc=contoso,dc=com”
PS AD:\dc=contoso,dc=com> dir
Name ObjectClass DistinguishedName
---- ----------- -----------------
Builtin builtinDomain CN=Builtin,DC=contoso,DC=com
Computers container CN=Computers,DC=contoso,DC=com
Contacts organizationalUnit OU=Contacts,DC=contoso,DC=com
Domain Controllers organizationalUnit OU=Domain Controllers,
DC=contoso,DC=com
ForeignSecurityPr... container CN=ForeignSecurityPrincipals,
DC=contoso,DC=com
c01.indd 47c01.indd 47 5/12/2011 1:07:57 PM5/12/2011 1:07:57 PM