0

I'm attempting to run a Powershell script that calls the Start-Process function in order to begin installing some monitoring software. I'm attempting to run it via a remote shell session I entered using Enter-PSSession. I've verified that the argument list and file path are correct in the line below.

Start-Process -FilePath $Installer -ArgumentList $ArgList -Wait -PassThru

When the script reaches this line however, it closes my remote session with the server I'm in and throws one of the following errors:

Processing data for a remote command failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host 
process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException

or

Starting a command on the remote server failed with the following error message : An operation is being attempted on a session that is being closed.This can happen if the 
session that is being used is also being closed by another thread. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException 

I've tried doubling the max memory allocation per shell to 2Gb but that hasn't helped. Has anybody experienced an issue like this before?

Olaf
  • 4,690
  • 2
  • 15
  • 23
Leon Smith
  • 51
  • 3
  • 8
  • Add `-NoNewWindow` to your `Start-Process`, it might give you extra information to help you troubleshoot. – jfrmilner Aug 25 '21 at 09:01
  • Does `$Installer` require a system reboot, or user sessions to be signed-out? – leeharvey1 Aug 25 '21 at 13:40
  • The installer doesn't require a reboot as I can run the script fine as an SSM doc via the AWS console with no instance reboots. I don't believe it should involve session sign outs - but I'll test that behavior now along with the `-NoNewWindow` flag – Leon Smith Aug 25 '21 at 20:47
  • The `-NoNewWindow` flag still encountered the same error unfortunately and I maintained other sessions when running the command in another. – Leon Smith Aug 26 '21 at 03:07

0 Answers0