为什么我无法在 Powershell 中导航 Active Directory?

Myr*_*rys 6 powershell windows-server-2008 active-directory

我有一个 AD: 驱动器,它应该允许我从 Powershell 中浏览活动目录。但是当我尝试使用它时,它不会让我超越根目录。从我读到的给定命令应该可以工作,但它们失败了。

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)
Run Code Online (Sandbox Code Playgroud)

uSl*_*ckr 7

您需要使用专有名称。试试cd dc=company,dc=com。请注意,选项卡完成在这里效果很好。所以试试吧cd dc=comp <tab>。它应该扩展到整个 DN