Get-ADForest - 找不到由以下标识的林:"xxxx"

Get-ADForest - Could not find a forest identified by: "xxxx"

这是我的命令 运行:

$Credentials = Get-Credential # Feed in credentials for some.domain.com
Get-ADForest -Server some.domain.com -Credential $Credentials

它报告:

Get-ADForest : Could not find a forest identified by: 'some.domain.com'

我已经为 -Server 参数尝试了各种不同的方法,包括使用 hostname.domain.name.com 但没有任何效果。有没有可能被屏蔽了?

但是,如果我 运行 a:

Get-ADUser username -Server 'some.domain.com' -Credential $Credentials

它returns值...

首先,您提到的两个例子是两个不同的CMDlet。别把他们两个搞混了。

关于获取 ADForest: 根据这个事实 sheet 关于 Get-ADForest

的信息判断

改用 -Identity "some.domain.com" 对您有帮助吗?据我所知,要么使用 -Identity 开关(这是强制性的),要么将对象通过管道传递给 CMDlet。

Identity 开关采用这些值:

  • 一个完全合格的域名
  • 一个 GUID (objectGUID)
  • DNS 主机名
  • NetBIOS 名称

测试:

    Get-ADForest -Identity 'some.domain.com' -Credential $Credentials

首先,您需要阅读 Get-ADForest 的文档以了解您的情况可能发生的情况:

The Get-ADForest cmdlet gets the Active Directory forest specified by the parameters. You can specify the forest by setting the Identity or Current parameters..........

To retrieve the forest of the local computer or current logged on user (CLU), set the Current parameter to LocalComputer or LoggedOnUser. When you set the Current parameter, you do not need to set the Identity parameter.......

When the Current parameter is set to LocalComputer or LoggedOnUser, the cmdlet uses the Server and Credential parameter values to determine the domain and the credentials to use to identify the domain of the forest according to the following rules......

-- If the Server and Credential parameters are specified:

The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the LocalComputer or LoggedOnUser. Then the credentials specified by the Credential parameter are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.


我认为您收到的错误是因为最后一行未得到满足。请根据您的情况进行验证,因为您指定的服务器似乎不在 LocalComputer 或 LoggedOnUser 的域中。