【发布时间】:2017-05-26 04:31:04
【问题描述】:
我编写了一个 powershell 脚本来远程执行一些操作系统验证。但是当远程服务器未启用 winrm 时,我收到以下消息。那么我如何强制 winrm 使用 psexec 远程启用?
**Connecting to remote server xxxxx.us.oim.com failed with the following error message : The WSMan service could not launch a host process to process the given request. Make sure the WSMan provider host server and proxy are properly registered.**
我在我的 powershell 脚本 PsExec.exe \$host -s powershell "Enable-PSRemoting -force" 中添加了一个命令(这里 $host 将给出主机名)这正在执行,同时我收到以下消息也。
PsExec.exe : Connecting to xxxxxxxxx.us.oim.com...
At line:72 char:1
+ PsExec.exe \\$fqdn -s powershell "Enable-PSRemoting -force"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Connecting to xxxxxxxxx.us.oim.com...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Starting PSEXESVC service on xxxxxxxxx.us.oim.com...Connecting with PsExec service on xxxxxxxxx.us.oim.com...Starting powershell on xxxxxxxxx.us.oim.com...
powershell exited on xxxxxxxxx.us.oim.com with error code 0
只有当“WSMan 服务无法启动主机进程来处理给定的请求”然后运行命令以启用 winrm 时才可能创建条件! 如果可能,请告诉我怎么做?
【问题讨论】:
标签: powershell