KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Powershell script timing out

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
gorisdean



Joined: 20 Jun 2012
Posts: 22

PostPosted: Tue May 02, 2023 9:01 am    Post subject: Powershell script timing out Reply with quote

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!
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Tue May 02, 2023 10:26 am    Post subject: Reply with quote

Quote:
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
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Tue May 02, 2023 10:28 am    Post subject: Reply with quote

Please note: your support and updates term expired in 2021

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
gorisdean



Joined: 20 Jun 2012
Posts: 22

PostPosted: Wed May 03, 2023 2:30 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
gorisdean



Joined: 20 Jun 2012
Posts: 22

PostPosted: Wed May 03, 2023 3:42 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Wed May 03, 2023 11:24 am    Post subject: Reply with quote

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

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
gorisdean



Joined: 20 Jun 2012
Posts: 22

PostPosted: Thu May 04, 2023 1:00 am    Post subject: Reply with quote

Windows Server 2016
Hostmonitor v12.98
Output to console with logging enabled was +/- 600 lines
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Thu May 04, 2023 11:51 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Thu May 04, 2023 11:53 am    Post subject: Reply with quote

Please note: your support and updates term expired in 2021

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12793
Location: USA

PostPosted: Thu May 04, 2023 2:24 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index