Hi, we have a custom Powershell script.
One the Hostmonitor server in a Powershell ISE window it runs only a few seconds without any issues.
When saving the script to a ps1 file and running it via command line, it runs fine as well.
In Hostmonitor (shell script test type) it times out for some reason, while the Timeout parameter is set high enough.
Also on the "Let's try" tab it times out.
It has been going good for months, but all of a sudden in started timing out.
We have another PS1 script acting the same. That has been disabled for some time now. When I gave it another try today, it worked again without a timeout.
What can I check to troubleshoot this?
Thanks!
Powershell script timing out
May be some Windows update lead to the problem with 32bit version of powershell while 64bit version still works fine?It has been going good for months, but all of a sudden in started timing out.
What exactly powershell command does not work now?
Could you try to start script using 32bit version from command line?
e.g. C:\Windows\syswow64\windowspowershell\v1.0\powershell.exe
and/or start script from HostMonitor using 64bit version?
C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe
Regards
Alex
Thanks for reverting back.
I've tried the script in a powershell console 64 bit and 32 bit, both work.
In Hostmonitor I've tried both versions of PS as well:
"C:\Windows\Syswow64\WindowsPowerShell\v1.0\powershell.exe" %script% %params%
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" %script% %params%
Both time out the same way.
It's a rather long script, also importing extra modules to do SSH commands towards a couple of appliances and fetch certificate details. I'll try to build up the script again and see when it starts timing out in Hostmonitor.
I've tried the script in a powershell console 64 bit and 32 bit, both work.
In Hostmonitor I've tried both versions of PS as well:
"C:\Windows\Syswow64\WindowsPowerShell\v1.0\powershell.exe" %script% %params%
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" %script% %params%
Both time out the same way.
It's a rather long script, also importing extra modules to do SSH commands towards a couple of appliances and fetch certificate details. I'll try to build up the script again and see when it starts timing out in Hostmonitor.
The script is iterating through a number of instances and logging a couple of lines to console (write-host) for each iteration.
These are only for troubleshooting as Hostmonitor is not using that information.
It caused a few 100 lines to be logged to console while the script was running.
I disabled this output and at first sight it looks like Hostmonitor is again capable of handling it. No more time outs so far.
The problem probably started popping up, because the number of iterations is growing over time.
Weird thing is that when running it manually in powershell, the script, with all output, only takes a few seconds.
When running it in Hostmonitor it times out when the output is enabled (+60seconds).
My guess currently is that Hostmonitor for some reason was choking on all the output to console. As that output is unnecessary in Hostmonitor, leaving it out the script is a reasonable thing to do and keep in mind.
These are only for troubleshooting as Hostmonitor is not using that information.
It caused a few 100 lines to be logged to console while the script was running.
I disabled this output and at first sight it looks like Hostmonitor is again capable of handling it. No more time outs so far.
The problem probably started popping up, because the number of iterations is growing over time.
Weird thing is that when running it manually in powershell, the script, with all output, only takes a few seconds.
When running it in Hostmonitor it times out when the output is enabled (+60seconds).
My guess currently is that Hostmonitor for some reason was choking on all the output to console. As that output is unnecessary in Hostmonitor, leaving it out the script is a reasonable thing to do and keep in mind.