New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.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


EXE/SCRIPT SENSOR Powershell not running on remote system.

Votes:

0

Your Vote:

Up

Down

I am running a powershell script sensor on a remote windows machine. The script checks for logon audit failures:

$count = (get-eventlog security -after (get-date).AddDays(-1) | where {$_.instanceid -eq 4625}).count write-host "$count`:OK"

The script runs but returns "0:OK" on the sensor (and in the log), however if I run the script on the remote system it returns something different, like "6:OK"

I suspected that the script was returning a value from the PRTG host system, not the remote machine, which I verified with the following:

$hostName = hostname if($hostName -eq "PRTG"){write-host "1:OK"}else{write-host "2:OK"}

And sure enough, the sensor returned "1:OK". So despite the sensor being put in the remote system, it is not running the script on that system.

Not sure where to go from here.

powershell probe remote

Created on Mar 26, 2019 9:16:00 PM by  ESLiain (0) 1



3 Replies

Votes:

0

Your Vote:

Up

Down

powershell scripts with custom EXE/XML sensors are running on the remote Probe operating system. if you want the script running on another machine you need to use Remote powershell.

for example

invoke-command -computername $remoteserver -scriptblock {$count = (get-eventlog security -after (get-date).AddDays(-1) | where {$_.instanceid -eq 4625}).count ; write-host "$count`:OK"}

the variable $remoteserver can be filled with the prtg host variable. So you can use the same script for all devices.

Created on Mar 27, 2019 7:59:28 AM by  xgwshof (0)



Votes:

0

Your Vote:

Up

Down

Thanks for chiming in! :)


PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Mar 27, 2019 11:12:48 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi there

Did you get this working?

Would you be able to share the finished script please.. I am really struggling to figure this out.

Kind regards Chad

Created on Mar 24, 2020 8:13:02 AM by  chadleywilson (0) 1



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.