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

running script on remote server



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){
Elseif ($server.count -eq $null -and $server -ne $null){
Write-Host "<prtg>"
Write-Host "<result>" 
"<channel>Locked Out Users</channel>" 
"<value>"+ $a +"</value>" 

"<text>"  + (($server | select SamAccountName | sort LockoutTime -descending | ConvertTo-Csv -NoTypeInformation | select -skip 1 ) -join ", ").replace("""","") + "</text> " 
Write-Host "</prtg>"

custom-script-exe exe-script-sensor powershell

Created on Jul 24, 2019 6:45:51 AM

Last change on Jul 24, 2019 6:48:28 AM by  Sven Roggenhofer [Paessler Technical Support]

1 Reply



Check this guide on HowToGeek for further information on Remote PowerShell and how to execute script stuff on remote hosts. You can get the result from your commands back in PowerShell and just continue to work with it :)

PRTGapi | Feature Requests | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jul 24, 2019 7:01:52 AM by  Stephan Linke [Paessler Support]

Last change on Jul 24, 2019 7:02:00 AM by  Stephan Linke [Paessler Support]

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.