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>"
Add comment