Check Windows Updates bad results

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Check Windows Updates bad results

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check Windows Updates bad results

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check Windows Updates bad results

Post 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
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check Windows Updates bad results

Post 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?
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check Windows Updates bad results

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check Windows Updates bad results

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked