我看过很棒的文章
PowerShell 2.0远程指南:第8部分 - 远程处理方案和故障排除
http://www.ravichaganti.com/blog/?p=1181
我有这个问题:我在域中有两台计算机,在网络中。
首次测试OK:从域中的计算机远程连接到域中的计算机
COMPANY_DOMAIN \ desmonitor是域用户
域名COMPANY_DOMAIN
电脑:iis01
PS C:\ Users \ myUser>输入-PSSession -Computername iisw01 -Credential COMPANY_DOMAIN \ desmonitor
[desiisw01]:PS C:\ Users \ desmonitor \ Documents>出口
第二次测试错误::使用本地管理员用户从域中的计算机远程连接到域中的计算机
iis01 \ instalador是机器iis01的本地用户
电脑:iis01
PS C:\ Users \ myUser>输入-PSSession -Computername iis01 -Credential iis01 \ instalador Enter-PSSession:连接到远程服务器失败,并显示以下错误消息:WinRM 客户端无法处理请求。
在使用COMPANY_DOMAIN \ desmonitor的终端服务器(远程桌面)的机器ii01中,我打开PS控制台并执行
PS C:\ Users \ desmonitor> winrm quickconfig
WinRM已设置为在此计算机上接收请求 WinRM已经设置为在此机器上进行远程管理 PS C:\ Users \ desmonitor>
然后,我再试一次,但我得到同样的错误:
PS C:\ Users \ myUser>输入-PSSession -Computername iis01 -Credential iis01 \ instalador Enter-PSSession:连接到远程服务器失败,并显示以下错误消息:WinRM 客户无法处理请求。
使用此命令:
PS C:\ Users \ myUser> Set-Item WSMan:\ localhost \ Client \ TrustedHosts -Value“*” - Force PS C:\ Users \ myUser>
现在,我可以访问:
PS C:\ Users \ myUser>输入-PSSession -Computername iis01 -Credential iis01 \ instalador [iiw01]:PS C:\ Users \ instalador \ Documents> $主机
Name : ServerRemoteHost
Version : 1.0.0.0
InstanceId : 6905896f-e6c7-4603-82f0-20183f71b1ec
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : es-ES
CurrentUICulture : es-ES
PrivateData :
IsRunspacePushed :
Runspace :
在我的公司,有许多计算机可以连接到iis01。
每个计算都需要执行命令,将远程计算机添加到本地计算机的可信主机列表中?
我有几个问题¿
如何在本地计算机上获取有关TrustedHosts(WSMan:\ LocalHost \ Client)的列表?
如何知道计算机中是否启用了WinRM服务?
如何知道WinRM服务是否在计算机上运行?
如何知道WinRM是否设置为在计算机中接收请求?
如何知道WinRM是否已设置为在此计算机上进行远程管理?
答案 0 :(得分:26)
Q1。如何在本地计算机中获取有关TrustedHosts(WSMan:\ LocalHost \ Client)的列表?
Get-Item WSMan:\localhost\Client\TrustedHosts
Q2 / Q3。如何知道计算机中是否启用了WinRM服务?我怎么知道WinRM服务是否在计算机上运行?
Get-Service -ComputerName server01 -Name winrm | Select Status
Q4。如何知道WinRM是否设置为在计算机中接收请求? 对此不太确定,但我会证实。一种查找方法是查看是否列出了客户端端口。但是,就像我说的那样,我可以证实这一点。
Get-ChildItem WSMan:\localhost\Client\DefaultPorts
Q5。如何知道WinRM是否已设置为在此计算机上进行远程管理?
您应该能够列出听众。
Get-ChildItem WSMan:\localhost\Listener
如果您在此处没有看到任何内容,则表示您未设置WSMAN传入连接。