Forum Discussion
Launch program remotely which must remain running
Hello everyone,
I have to start and leave programs running on some remote PCs, I used invoke-command with start-job and start-process. Launching the script from my powershell window, the executables remain running until I close the window itself, I believe for reasons of remote sessions started. So if I schedule the start of this script in the Windows "Task Scheduler", the session is opened and closed and the executables start and close shortly after, that is, when the scheduled task completes. I also set the "-noexit" argument, but nothing happened. What can I do so that I can schedule these startups and let the affected programs run?
I hope I was clear, ask if you need it, thanks everyone.
3 Replies
- Bart_PasmansCopper Contributor
If you are dealing with remoting you can look into psexec:
https://learn.microsoft.com/nl-nl/sysinternals/downloads/psexec
Keep in mind that what you running remotely happens in a different context than your user context is. How do you want to run the program? As specific user? System context? Etc.
I know that psexec did helped me in the past with something like this. Did that answer your question?
start-process c:\windows\system32\cmd.exe -Wait, for example, should start a cmd prompt and the -Wait will keep it running until closed