What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

account lockout script

Votes:

0

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

exe-script-sensor exexml prtg-server-exe

Created on Jul 22, 2019 2:47:17 PM

Last change on Jul 22, 2019 3:10:59 PM by  Dariusz Gorka [Paessler Support]



8 Replies

Votes:

0

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.

Created on Jul 22, 2019 3:11:40 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

the sensor is not failing g is in green state and bellow the sesnor name is simple ok no lockout account name no nothing :)

Created on Jul 23, 2019 6:28:38 AM



Votes:

0

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.

Created on Jul 23, 2019 7:39:31 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

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

Created on Jul 23, 2019 8:08:41 AM



Votes:

0

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.

Created on Jul 23, 2019 10:31:00 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

i did activate it but for some reason, no logs are created

Created on Jul 23, 2019 10:32:19 AM



Votes:

0

Hi there,

Have you checked the folder on the correct probe?

Best regards.

Created on Jul 23, 2019 10:59:23 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

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

Created on Jul 24, 2019 8:37:20 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.