How can I increase the timeout for a custom powershell activity?

mdenni
Kilo Expert

I have a workflow that installs software on Windows using powershell custom activities. I split it into several activities, one to check if the software is already installed, one to copy the files needed to the computer, and one to install the software. When it installs Office, it fails during the install portion because it times out after 610 seconds.

Most programs install fine within that timeout period. Is there a way I can increase the timeout period from within the activity or a run script so that I am not changing the timeout for all scripts that run on the MID Server, but just when I am installing programs that take a long time like Office.

8 REPLIES 8

rhiannone1
Kilo Contributor

Hi Mark,


Did you make any progress on this? I am also trying to extend the probe timeout. And trying to understand if it is possible to parse a parameter to the probe, see: How can I extend the orchestration timeout for an activity?


Thanks,



But, frankly, I did not understand this article well enough to put it into


practice. And I also created a ticket with ServiceNow and they told me I


couldn't change the timeout.



I have already rewritten my code to use a persistent remote session, to run


the installs as a job, to query the job every 30 seconds, and before the


timeout is reached, if the job has not completed, to disconnect and save


the variables I need as an XML file, and passing the file name to another


activity which recreates the variables, reconnects to the session, and


continues checking until the job completes - thus almost doubling the


timeout time.



Unfortunately, although my code works in Powershell itself, it doesn't work


in a ServiceNow Orchestration custom powershell activity. So, currently I


have a case open about that.




Mark Denni


Systems Engineer


ANSYS, Inc.


2855 Telegraph Ave., Suite 501


Berkeley, CA 94705


mark.denni@ansys.com


New! Help Desk Line: 1-844-ANSYS-HD


Tel: (510) 999-4931


IT Help - ANSYS ServiceNow: https://ansys.service-now.com/ess/


Webex Support: 866-569-3239


Kronos Support: hrissupport@ansys.com


SSO Website: https://myapps.microsoft.com/ansys.com


SSO FAQ: HERE


<https://docs.google.com/a/ansys.com/document/d/1qGTExzJIxlkhvZQ0Lr8GeWYu0DotGvBSUAJ-4z4YW44/edit?usp=docslist_api>


Not sure why the ServiceNow technician told you this wasn't possible. You can change the value via the MID server parameter called "mid.windows.probe_timeout". You'll want to change the parameter on any MID server with the Orchestration Application. It stores a number value in terms of seconds. So if you want the timeout to be one hour, enter '3600' for the value. You can read up more about MID server parameter here: MID Server parameters



And just to link a thread I posted a similar answer on: Powershell default timeout value


mdenni
Kilo Expert

I explained to a ServiceNow technician the struggles I have gone through because of this timeout issue, and there is a slight possibility that they will take my suggestion as a feature request for the future.


In the meantime, I keep splitting my activities into smaller and smaller pieces, and also use a trick I came up with. What I am doing is running installs of various types, and on the ones I know are going to take longer, I run as Disconnected sessions using this bit of code:


if ($InDisSess) {


  icm -ComputerName $Computer -InDisconnectedSession -ScriptBlock $ScriptBlock -ArgumentList $PI, $PA, $PF, $wDir, $Computer, $RC  


} else {


  icm -ComputerName $Computer -ScriptBlock $ScriptBlock -ArgumentList $PI, $PA, $PF, $wDir, $Computer, $RC


}


Here, $PI is the program Installer, $PA are the Program Arguments, $wDir is the Folder where the Program Installer resides, $Computer is the name of the target Computer, and $RC is a remnant from when the activity also did a robocopy of either just the Program Installer, or all the files and subfolders under where the program Installer resides.


[Since I'm writing this for my company, I don't think I can share the whole thing.]



In my original version, which I can't use because of the Timeout issue, I can get detailed error information in case something goes wrong, which was very helpful when I wanted to add a new, untested package installer. But now, I just get Job Running, or Completed, or Disconnected.