powershellremotingpagefile

Powershell remoting and page file


I wrote a powershell script that connects to a remote machine with the intent of executing a software rollout on said machine. Basically it connects, maps a drive, copies the rollout from the mapped drive to the target machine, then executes a perl script to install the rollout. If I do those steps manually everything works fine. When I try using my script, the perl script fails on the remote machine saying, "The paging file is too small for this operation to complete".

Can someone explain the considerations I need to take into account when operating remotely? I've tried monitoring memory usage and I don't see anything out of the ordinary. Is the page file OS wide or is there some type of per user configuration my script should be setting when it connects?

I can post snippets of my script if needed, but the script is 426 lines so I think it would be overwhelming to post in its entirety.


Solution

  • I found that the remote shells are managed differently than logging onto the box and executing a powershell session. I had to increase the maximum amount of memory available using one of the commands below:

    Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024
    
    winrm set winrm/config @{MaxMemoryPerShellMB="1024"}
    

    The default is 150MB which didn't cut it in my case. I can't say that I recommend 1GB, I'm just a developer. I tried upping it until I found what worked for me.