我有一个 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)
答案1
您需要使用 Distinguished 名称。尝试cd dc=company,dc=com
。请注意,制表符补全在这里很有效。因此,尝试cd dc=comp <tab>
。它应该扩展到整个 DN
答案2
这是因为您需要使用 DistinguishedName,而不是 Name。
PS AD:\> cd "DC=Company,DC=Com"