hello i am using the following script to monitor lockout accounts
the problem is that i have locked 2 tested accounts and yet in prtg sensor, i see that value is 0 when i am running this script in PowerShell is perfect it sows all i need but in prtg dashboard, i get 0 reports can some help
Import-Module ActiveDirectory $server=Search-ADAccount -LockedOut -UsersOnly | Where-Object {$_.Enabled -like “true”} if ($server.count -eq $null -and $server -eq $null){ $a=0 } Elseif ($server.count -eq $null -and $server -ne $null){ $a=1 } Else { $a=@($server.count) } Write-Host "<prtg>" Write-Host "<result>" "<channel>Locked Out Users</channel>" "<value>"+ $a +"</value>" "</result>" "<text>" + (($server | select SamAccountName | ConvertTo-Csv -NoTypeInformation | select -skip 1 ) -join ", ").replace("""","") + "</text>" Write-Host "</prtg>"
Article Comments
the sensor is not failing g is in green state and bellow the sesnor name is simple ok no lockout account name no nothing :)
Jul, 2019 - Permalink
Hi there,
As long as the sensor offers output and valid channels, you won't see an error. Therefore please still check the sensor results.
Best regards.
Jul, 2019 - Permalink
hey guys thanks for your replys the problem is they are lockout accounts in my ad when i run the script simple from powershell i can see them the sensor in prtg simple gives me an ok and the vallue stays to 0 for some reason but for sure i have lockout accounts
Jul, 2019 - Permalink
Hi there,
Have you read my initial reply? Please activate the "Write Result to Disk"-option in the sensor settings and check the result files. It is possible that the scripts acts completely different when executed via PRTG.
Best regards.
Jul, 2019 - Permalink
fixed the problem was the account was running under system i changed the creadntia to parent windows and is working thank you all for your support
Jul, 2019 - Permalink
Hi there,
Please activate the "Write EXE result to disk" option in the sensor's settings and check the log files (Result of Sensor XXX.Data.txt and Result of Sensor XXX.txt) located on the corresponding probe under "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)".
Do you see any reasons for the sensor to fail?
Best regards.
Jul, 2019 - Permalink