Powershell script timing out

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
gorisdean
Posts: 22
Joined: Wed Jun 20, 2012 7:56 am

Powershell script timing out

Post by gorisdean »

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!
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

It has been going good for months, but all of a sudden in started timing out.
May be some Windows update lead to the problem with 32bit version of powershell while 64bit version still works fine?

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
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Please note: your support and updates term expired in 2021

Regards
Alex
gorisdean
Posts: 22
Joined: Wed Jun 20, 2012 7:56 am

Post by gorisdean »

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.
gorisdean
Posts: 22
Joined: Wed Jun 20, 2012 7:56 am

Post by gorisdean »

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.
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Just 100 lines? We cannot reproduce the problem.
Windows version?
HostMonitor version?

Regards
Alex
gorisdean
Posts: 22
Joined: Wed Jun 20, 2012 7:56 am

Post by gorisdean »

Windows Server 2016
Hostmonitor v12.98
Output to console with logging enabled was +/- 600 lines
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

We tested such config, script itself needs 3sec for 600 lines output (its not your script, just test script to write 600 lines to console)
HostMonitor needs milliseconds to process results.

May be problem relates to your antivirus? Which one do you use? Could you try to disable it?

Regards
Alex
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Please note: your support and updates term expired in 2021

Regards
Alex
KS-Soft
Posts: 12846
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

We reproduced the problem on larger amount of data. We will add new options for version 14.00.
If you need fix ASAP, we can provide unofficial version 13.97. But I think your old license does not allow updates..

Regards
Alex
Post Reply