For those who like to get this going: this was my solution :)
1. Install NSClient++ for x64 systems. 2. Configure it to run NRPE too 3. Put your powershell scripts under the scripts directory of NSClient++ 4. Add an ‘external scripts’ entry like this: check_mdb01=cmd /c echo scripts/Check-Exchange-Database-Mdb01.ps1 | powershell.exe -command - (do not put quotes around your script name!!) Done. The catch were the quotes that I used around the script. With this setup you can run powershell scripts in a x64 environment. Excellent for Exchange 2010 checks :) Regards, Toni Van Remortel System Engineer @ Precision Operations N.V. +32 3 451 92 20 - [email protected] Satenrozen 2a, 2550 Kontich, Belgium From: Toni Van Remortel Sent: woensdag 31 maart 2010 12:07 To: Opsview Users Subject: RE: NRPE for Windows and Powershell scripts Some extra info I found: - the execution policy for scripts is different between the x64 and the x86 subsystem. So you need to set the execution policy in the x86 powershell too. - nrpe_nt is running as a x86 service, and my check script loads the Exchange snapin ... which can only be used in a x64 script. Solution would be to: - either run the nrpe_nt service as native x64 service - get the Exchange snapin to load in an x86 subsystem (pretty unlikely with Exchange 2010, as it is 64-bit only). More thoughts on a solution? Toni Van Remortel System Engineer @ Precision Operations N.V. Satenrozen 2a - B-2550 Kontich - Belgium +32 3 451 92 26 ________________________________ From: [email protected] [[email protected]] on behalf of Toni Van Remortel [[email protected]] Sent: Wednesday, March 31, 2010 11:45 To: Opsview Users [[email protected]] Subject: [opsview-users] NRPE for Windows and Powershell scripts Hi, I created a powershell script that checks my Exchange 2010 DAG replication status, but I can't get it working via NRPE. The commands tested: command[mdb_01]=cmd /c echo "C:\Tasks\Check-Exchange-Database-Mdb01.ps1" | powershell.exe -command - command[mdb_02]="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -nologo -command "C:\Tasks\Check-Exchange-Database-Mdb02.ps1" Neither of them will work. The script does return an exit code, so that's not the source of the problem. Anybody succesfully used powershell scripts behind NRPE on Windows? Thanks. Toni Van Remortel System Engineer @ Precision Operations N.V. Satenrozen 2a - B-2550 Kontich - Belgium +32 3 451 92 26
_______________________________________________ Opsview-users mailing list [email protected] http://lists.opsview.org/lists/listinfo/opsview-users
