Session Operation has timed out

I am running into this error sporadically on a scheduled job. I’m trying to figure out if it is specific to UA or if it just my novice PowerShell skills. Note, there are several jobs scheduled on the hour every hour that all connect to a SQL database. They are not long running scripts. Probably 10 seconds.

Session operation has timed out at System.Management.Automation.Runspaces.AsyncResult.EndInvoke() at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult) at UniversalAutomation.Host.EntryPoint.ExecuteScript(executeScriptRequest request, ServerCallContext context) in D:\a\universal\universal\src\Host\EntryPoint.cs:line 173

Product: PowerShell Universal
Version: 1.5.16

This looks like it’s coming from your script but you can determine that by putting a little error handling in it.

Try using a try catch to see where in the script it is occurring.

try {
#script
} catch {
throw "Script Failed at $($_.ScriptStackTrace)
}

Thanks, Adam. I did that and I’m just waiting for it to happen again. I think it has something to do with a Posh-SSH sftp session.