6

I have an AD: drive, which should allow me to browse active directory from within Powershell. But when I try to use it, it will not let me navigate beyond the root. From what I have read the given commands should work, but they are failing.

PS AD:\> ls

Name                 ObjectClass          DistinguishedName
----                 -----------          -----------------
company              domainDNS            DC=company,DC=com
Configuration        configuration        CN=Configuration,DC=company,DC=com
Schema               dMD                  CN=Schema,CN=Configuration,DC=company,DC=com
ForestDnsZones       domainDNS            DC=ForestDnsZones,DC=company,DC=com
DomainDnsZones       domainDNS            DC=DomainDnsZones,DC=company,DC=com

PS AD:\> cd schema
Set-Location : Cannot find path 'AD:\schema' because it does not exist.
At line:1 char:3
+ cd <<<<  schema
    + CategoryInfo          : ObjectNotFound: (AD:\schema:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

PS AD:\> cd Schema
Set-Location : Cannot find path 'AD:\Schema' because it does not exist.
(duplicate of previous error)

PS AD:\> cd company
Set-Location : Cannot find path 'AD:\company' because it does not exist.
(duplicate of previous error)

PS AD:\> ls Schema
Get-ChildItem : Cannot find path '//RootDSE/Schema' because it does not exist.
(duplicate of previous error)

PS AD:\> cd ForestDnsZones
Set-Location : Cannot find path 'AD:\ForestDnsZones' because it does not exist.
(duplicate of previous error)

2 Answers 2

7

You need to use the Distinguished name. Try cd dc=company,dc=com. Note that tab completion works well here. So try cd dc=comp <tab>. It should expand to the whole DN

1
  • The tab completion might add backslashes and dots like `.\dc=company,dc=com` which will cause the operation to fail. Recommend removing those to get it to work.
    – Mister_Tom
    Nov 15, 2019 at 20:29
2

That's because you need to use the DistinguishedName, not the Name.

PS AD:\> cd "DC=Company,DC=Com"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .