Hello everyone
i have the script you will see bellow what i would like to do is this script be on one remote server and run on that server and simple saw me the result in prtg sensor is that thing even possible?
Import-Module ActiveDirectory $server=Search-ADAccount -LockedOut -UsersOnly | select SamAccountName,displayname #Where-Object {($_.SamAccountName -ne "krbtgt" -and $_.SamAccountName -ne "guest" -and $_.SamAccountName -ne "SUPPORT_388945a0" -and $_.SamAccountName -ne "host")} 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 | sort LockoutTime -descending | ConvertTo-Csv -NoTypeInformation | select -skip 1 ) -join ", ").replace("""","") + "</text> " Write-Host "</prtg>"
Add comment