但是,当我尝试从任何计算机(在网络内或通过VPN连接从另一个网络)使用IP地址作为目标时,我失败了。我希望能够通过VPN连接使用远程控制,因为在这种情况下必须使用IP地址,无法解析主机名。
我不想在我的hosts文件中添加名称,因为我们客户端的其他几个服务器具有相同的DNS名称,我不想一次又一次地删除并插入名称-IP地址关联。
我希望有人告诉我如何允许通过IP调用psremoting目标。
编辑:更具体地说,我希望能够运行以下内容:
Enter-PSSession -Computername 192.168.123.123 -credentials $cred
如果我想用“-Computername
”运行该命令,只有在传递主机名时才能运行。
编辑2:
当我尝试使用IP地址进行登录(来自内部网络)而不是主机名时,出现以下错误消息:
Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot process
the request. Default authentication may be used with an IP address under the following conditions: the transport is HT
TPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure T
rustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to se
t TrustedHosts run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting
Help topic.
编辑3:
我知道WSMan的trusted-hosts设置,但那似乎不是问题所在。它已经设置为“*”(在启用远程之后我就这样做了),但我仍然无法使用IP作为目标计算机名称连接到该服务器,但我可以使用主机名作为目标计算机名称进行连接。看起来像是IIS中的绑定防止侦听器监听针对IP地址而非主机名的请求。但是并没有安装IIS。我不知道要查找此类设置的位置。
更新2011-07-12:
好吧,我认为trustedhosts-setting不是问题,因为我可以通过主机名从我们的DC连接,但如果我使用目标计算机参数的目标IP地址,就无法连接。
我认为问题必须是侦听器。也许侦听器不接受针对目标IP而非目标主机名的请求。但我不知道如何更改。
Enable-PSRemoting
没有-ComputerName
参数。您是不是想使用Enter-PSSession
命令? - Rynant