一.实验环境

PowerShell远程管理Windows Server(3):工作组环境_工作组

二.操作步骤

(1)在server端输入“Enable-PSRometing”,启用远程连接;(具体操作参考:http://281816327.blog.51cto.com/907015/1397239

(2)在client端输入set-item wsman:\localhost\client\trustehosts –value “192.168.11.53”,将server设置为client的信任主机。

PowerShell远程管理Windows Server(3):工作组环境_PowerShell_02

以避免一下的错误;

(

错误内容为Enter-PSSession : 连接到远程服务器 192.168.11.53 失败,并显示以下错误消息: WinRM 客户端无法处理该请求。   

身份验证。 有关如何设置 TrustedHosts 的详细信息,请运行以下命令: winrm help config。 有关详细信息,请参    所在位置 行:1 字符: 1    
+ Enter-PSSession -ComputerName 192.168.11.53 -Credential contoso.test\administrat ...    
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    + CategoryInfo          : InvalidArgument: (192.168.11.53:String) [Enter-PSSession],PSRemotingTran     + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

)

PowerShell远程管理Windows Server(3):工作组环境_PowerShell_03

(3)输入“enter-pssession –computername 192.168.11.53 –credentrial contoso.test\administrator”,输入密码后即可远程登入server;(具体操作参考:http://281816327.blog.51cto.com/907015/1397239

 

附注:

(1)信任主机可以设置为一个网段,例如192.168.11.*

(2)或者一个域名,例如iis01.contoso.test