powershell remoting Win2008R2 "The WSMan service could not launch a host process to process the given request" powershell remoting Win2008R2 "The WSMan service could not launch a host process to process the given request" powershell powershell

powershell remoting Win2008R2 "The WSMan service could not launch a host process to process the given request"


You need to be setting the WSMan TrustedHosts. If you want, you can set it to everything using wildcards (*).

You can do it via PowerShell: Set-Item WSMan:\localhost\Client\TrustedHosts -Value *.

Keep in mind that you also need to enable the Windows Remote service. Use the native winrm qc command for this. Enable-PSRemoting -Force might do it as well.

You can also use the PSExec Tools from Sysinternals. Keep in mind that these tools will likely be blocked by your EndPoint Security, so don't forget to white list it.

Is there a specific reason you migrate your old OSes to a newer, but still EOL OS? You can do a lot via PowerShell in 2008R2, but it's still pretty limited. IMO, Using PowerShell is best starting from 2012R2 and onwards.


You can get this error when trying to connect to localhost with an account that's not an administrator.

It used to be possible to use accounts that weren't an administrator, but a Windows Update in January 2019 disabled the functionality for security reasons. From the patch notes:

By default, PowerShell remoting only works with administrator accounts, but can be configured to work with non-administrator accounts. Starting with this release, you cannot configure PowerShell remote endpoints to work with non-administrator accounts. When attempting to use a non-administrator account, the following error will appear:“New-PSSession: [computerName] Connecting to remote server localhost 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. For more information, see the about_Remote_Troubleshooting Help topic.”


Are you hitting the number of processes limit by creating pssessions that are crashing and leaving processes open?

Default limit is 15. I'd agree with the above comment and not use sessions, instead use invoke-command like:

invoke-command -scriptblock $scriptBlock -ArgumentList $args -computername $compName -Credential $encodedRemoteCredentials

to Check your limit:

PS C:\aws> ls WSMan:\localhost\Shell   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\ShellName                      Value----                      ----MaxProcessesPerShell      15

As a quick and dirty test - next time your pssession version of your script fails, increase the maxProcessesPerShell limit using set-item cmdlet to 50 and retry. If the script no longer fails, you know that's the issue (and should consider moving to invoke-command!).