我试图在新机器上以混合域模式启用win rm。
从另一个工作站,我可以连接下面的命令:
Enter-PSSession -ComputerName 89.251.114.100 -Credential $ mycred
我在新机器上运行了Enable-PSremoting,但是当我执行下面的命令时,我得到:
Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied. For more info rmation, see the about_Remote_Troubleshooting Help topic. At C:\Users\Dev1\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:93 char:17 + Enter-PSSession <<<< -ComputerName 89.251.114.100 -Credential $mycred + CategoryInfo : InvalidArgument: (00.000.000.000:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
这是InvalidArgument,让我觉得奇怪。
有趣的是,我可以执行远程命令:
powershell.exe -ExecutionPolicy不受限制C:\ root \ deploy.ps1 – input格式无
您的PSCredential对象中的用户帐户是否属于目标机器的pipe理员组?
您是否在提升的命令提示符下在新机器上运行winrm quickconfig ? 它应该启动winrm服务并在tcp端口5985上创build一个具有相应防火墙例外的winrm侦听器。 然后,您可以尝试运行winrs -r:http://<targetmachine>:5985 -u:<targetmachine>\<administrator account> "dir c:\"并查看是否输出C:的内容。 这表明你winrm工作正常。
之后,再次尝试在目标机器上运行Enable-PSRemoting(再次在提升的Powershell提示符下)。