几个小时后,Powershell远程工作被杀(Powershell remote job getting killed after a few hours)

我正在运行一个远程工作作为部署的一部分,应该永远运行(播种随机数据)但是这个过程在几个小时后就会被杀死。我正在计算一些丢失的远程服务标志或其他东西。

我通过此powershell命令运行远程作业

Invoke-Command -ComputerName DEPLY -Credential $cred -AsJob -ScriptBlock { C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y }

有没有办法防止这个过程被杀?

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?

最满意答案

所以在我看来,PowerShell作业只有一个未记录的终止超时。 我确认我的程序没有崩溃,远程服务只是在3-4小时后就将其杀死。 或者它可能是操作系统的东西 - 我不知道。

我切换到psexec ,这不会弄乱进程 - 这是命令:

psexec \\DEPLY -accepteula -d -u "corp\administrator" -p "xxx" C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y

您也可以通过WMI启动它,如下所示:

$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" )

但我无法确认以这种方式创建的远程进程是否会永久存在。 每个测试需要4个小时,我完成了这个。

相关: 在远程会话中启动后台任务,在删除会话时不会被杀死

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

几个小时后,Powershell远程工作被杀(Powershell remote job getting killed after a few hours)

我正在运行一个远程工作作为部署的一部分,应该永远运行(播种随机数据)但是这个过程在几个小时后就会被杀死。我正在计算一些丢失的远程服务标志或其他东西。

我通过此powershell命令运行远程作业

Invoke-Command -ComputerName DEPLY -Credential $cred -AsJob -ScriptBlock { C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y }

有没有办法防止这个过程被杀?

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?

最满意答案

所以在我看来,PowerShell作业只有一个未记录的终止超时。 我确认我的程序没有崩溃,远程服务只是在3-4小时后就将其杀死。 或者它可能是操作系统的东西 - 我不知道。

我切换到psexec ,这不会弄乱进程 - 这是命令:

psexec \\DEPLY -accepteula -d -u "corp\administrator" -p "xxx" C:\Deply\${bamboo.Configuration}\Seed\Seed.exe /y

您也可以通过WMI启动它,如下所示:

$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" )

但我无法确认以这种方式创建的远程进程是否会永久存在。 每个测试需要4个小时,我完成了这个。

相关: 在远程会话中启动后台任务,在删除会话时不会被杀死

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