If I start a remote PowerShell session with:
Enter-PSSession -ComputerName somecomputer
Then I want to execute a long-running process:
[somecomputer]: PS C:\>
C:\SomeApp\DoSomething.exe
If my remote session is disconnected for whatever reason – such as a local machine network outage or reboot – is there any way to ensure that the command still completes on the server?
From what I'm seeing, it seems to go away as soon as my PS session dies. I've also tried Start-Process
, but it seems to behave the same.
I'm trying to run things on a server without having to RDP in. Still a beginner in PowerShell, so I'm sure there are plenty of things I'm missing. I'm on Win10, PowerShell 7, connecting to Windows Server 2016, but I assume it would be the same anywhere.
Best Answer
I think what you're looking for is
New-PSsesion