Build precise queries to find exactly what you need
Press ESC to close
This useful script gives good control on the state of your AD accounts. I wanted to show a Warning at 1 and Critical at 2 or more errors, ran into a problem with the script.
Solution:
returning 0 or one element in an array results in a different return variable not supporting the .Count property
change the invoke-expression line to $result=@(invoke-expression -Command “$command” -OutBuffer 1000)
to correctly process the return value of the script in the NSClient++ call of the powershell script and pass it on we need to use exit $lastexitcode otherwise we are passing on the success of powershell not the return value of the script itself.
So the NSClient++ ini file needs to contain lines like this:
check_ps_lotp_check_ad_account_disabled=cmd /c echo scriptslotp_check_ad_accounts.ps1 AccountDisabled “cn=AAA,dc=BBB,dc=com” Subtree 0 1; exit $lastexitcode | powershell.exe -noprofile -executionpolicy bypass -command –
cn= evaluation is not evaluated by the script, some changes are needed there too or just hardcode the SearchBase variable
That’s it!
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!