New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


running script on remote server

Votes:

0

Your Vote:

Up

Down

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
{
    [email protected]($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>"

custom-script-exe exe-script-sensor powershell

Created on Jul 24, 2019 6:45:51 AM by  cgav (0) 1

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



1 Reply

Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.