-1

I try to run a command on about 42 servers, and the script got stuck and failed.

When I try to run Invoke-Command on the one of the failed servers, I got:

Connecting to remote server $$$$ 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.

WinRM service is up on the remote servers. I ran Enable-PSRemoting on the remote.

WinRM settings:

MaxEnvelopeSizekb  - 500
MaxTimeoutms  - 60000
MaxBatchItems - 32000
TrustedSites  - *

Running the script from another server fails too, randomly on other servers from the list.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Itzik
  • 107
  • 1
  • 3
  • 11
  • [Maybe related](https://blogs.technet.microsoft.com/davguents_blog/2010/12/10/the-case-of-the-psremotingtransportexception/). For further help please show the command you were running (you can omit the content of the scriptblock) as well as the full error message. Are you able to reproduce the problem when running the command just against that server, or does the problem occur with random hosts when you run the command against multiple servers? – Ansgar Wiechers Jan 28 '18 at 12:53
  • Did you follow [these instructions](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_troubleshooting?view=powershell-3.0) (which I'm certain the error message asked you to)? What were the results? [Also related](https://blogs.technet.microsoft.com/jonjor/2009/01/09/winrm-windows-remote-management-troubleshooting/). – Ansgar Wiechers Jan 28 '18 at 12:53
  • hi @AnsgarWiechers, the error not listed... – Itzik Jan 28 '18 at 13:54
  • The error not listed ... *what*? – Ansgar Wiechers Jan 28 '18 at 14:09
  • my error: "the WSMan service could not launch a host process to process the given request." not in list in the given link... – Itzik Jan 28 '18 at 14:48
  • I gave you 3 links. The first link I provided most definitely *does* feature this exact error message. The other 2 links are general WinRM troubleshooting guidelines, so of course they won't feature a particular error message. – Ansgar Wiechers Jan 28 '18 at 14:53
  • Thank you, but it did not solved the problem... – Itzik Jan 29 '18 at 09:50
  • Did. You. Follow. The. Troubleshooting. Guidelines? – Ansgar Wiechers Jan 29 '18 at 11:14

1 Answers1

0

I had solved it... The problem caused because a GPO which delete the profiles of the users so when I do ICM, the command make a profile on the remote server, and because the profile deleted, the icm failed...

I run this successfuly:

Invoke-Command -ComputerName $Ip -ScriptBlock {***} -ArgumentList $IP -Credential $cred -ThrottleLimit 100  -AsJob ***-SessionOption ( New-PSSessionOption -NoMachineProfile)***
Itzik
  • 107
  • 1
  • 3
  • 11