我有寫了一個PowerShell腳本,做一些OS驗證remotely.But當遠程服務器不使用WinRM使我得到以下message.So我怎麼能強迫WinRM的遠程啓用啓用使用psexec?如何WinRM的可使用PSEXEC從PowerShell的
**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 \ $主機-s PowerShell的「啓用,PSRemoting -force」(這裏$主機會給主機名)這是執行,並在同一時間,我我也得到下面的消息。
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的! 如果可能請讓我知道如何?
https://community.spiceworks.com/scripts/show/2703-remotely-enable-winrm-powershell –