Page 1 of 1

Windows Disk Cleanup via Powershell

Posted: Mon Nov 30, 2015 1:17 pm
by jpelley
So my Windows guys created a Powershell script to do some minor C:/ cleanup and want me to add the script to NagiosXI when a Warning is generated. I understand how event handling works in Nagios but my scripting skills are limited. Where do I start, what is best practice? I've scoured old posts and see where some use NCSA or NRPE or some other methodologies I'm not familiar with. We use agent-less monitoring via WMI and I'd love to continue with an agent-less process (or at least pass a Host arg to a Windows gateway server to execute).

Re: Windows Disk Cleanup via Powershell

Posted: Mon Nov 30, 2015 1:29 pm
by hsmith
I really can't say for sure, but running remote code on a Windows machine without an agent is going to be difficult.

I did find this article, https://4sysops.com/archives/three-ways ... e-commands but it's kind of out of the scope of what we're going to be able to help you with.
jpelley wrote:Where do I start, what is best practice?


Event handlers are exactly what you are looking for. To be completely honest, NSClient would be your best friend in this scenario, but doing it via WMI is going to be tough.