Page 1 of 1

Check Windows Updates bad results

Posted: Fri Nov 02, 2018 7:18 am
by kwhogster
Nagios Core 4.3.4
Nsclient 4.3 and up

Asking this again I thought it was working

scriptscheck_windows_updates.ps1 : The module 'scripts' could not be loaded.
For more information, run 'Import-Module scripts'.
At line:1 char:1
+ scripts\check_windows_updates.ps1 $ARG1$ $ARG2$; exit $LastExitCode
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (scripts\check_windows_updates.p
s1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoLoadModule


I have many Machines and they all have the same check only on 5 of them I get the above results.

It shows OK but the results are not valid

Any ideas

Thank you

Tom

Re: Check Windows Updates bad results

Posted: Fri Nov 02, 2018 1:43 pm
by npolovenko
Hi, @kwhogster. You need to put the script in the scripts folder.
C:\Program Files\NSClient++\scripts
This is the command:
check-updates = cmd /c echo scripts\check_windows_updates.ps1; exit $LastExitCode | powershell.exe -command -
Then you need to open a powershell console on the windows server as an admin and execute these two commands:
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy ByPass

Re: Check Windows Updates bad results

Posted: Fri Nov 02, 2018 3:49 pm
by kwhogster
Thank you

Just tested on one server and that works now.

I did have the script in c:\program files\nsclient++\scripts\powershell

But I moved it to the scripts folder and used your command

Will check the others later

Will post results.

Thank you

Tom

Re: Check Windows Updates bad results

Posted: Fri Nov 02, 2018 8:12 pm
by kwhogster
Update

Got it working on all but two machines.

1, Windows 7 Pro Laptop when I run the script on the laptop directly it never completes.
2. My windows 10 Pro Desktop the same the script never finishes.

For the time being I removed them from the configs.

Any thoughts?

Re: Check Windows Updates bad results

Posted: Sat Nov 03, 2018 1:23 pm
by kwhogster
Ok I got them working now I found this
https://blog.redbranch.net/2014/01/09/n ... s-updates/

This is a two step approach you set up a scheduled task to check for updates then it writes a file
The Nagios check reads the file and post the results.

Very nice

Please lock this as resolved

Re: Check Windows Updates bad results

Posted: Mon Nov 05, 2018 10:15 am
by scottwilkerson
kwhogster wrote:Ok I got them working now I found this
https://blog.redbranch.net/2014/01/09/n ... s-updates/

This is a two step approach you set up a scheduled task to check for updates then it writes a file
The Nagios check reads the file and post the results.

Very nice

Please lock this as resolved
glad to hear the issue is resolved

Locking