I am running a remote job as part of a deployment which is supposed to run forever (seeding random data) however the process keeps getting killed after only a few hours.. I am figuring some missing remote service flag or something.
I am running the remote job via this powershell command
Invoke-Command -ComputerName DEPLY -Credential $cred -AsJob -ScriptBlock {
C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y
}
Is there someway to prevent this process from being killed?
So it seems to me there is just an undocumented kill timeout for powershell jobs. I confirmed that my program is not crashing and the remoting service is just killing it after 3-4 hours. Or maybe its an OS thing - I don't know.
I switched to psexec which doesn't mess with the process - here is the command:
psexec \\DEPLY -accepteula -d -u "corp\administrator" -p "xxx" C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y
You can also launch it via WMI like so:
$process = get-wmiobject -query "SELECT * FROM Meta_Class WHERE __Class = 'Win32_Process'" -namespace "root\cimv2" -computername DEPLY -credential $cred
$results = $process.Create( "C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y" )
But I can't confirm if a remote process created this way lasts forever. Each test takes 4 hours and Im done messing with this.
RELATED: Launching background tasks in a remote session that don't get killed when the session is removed