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

Custom EXE Powershell script running on core, not target



I wrote a simple script to check to see if the PRTG console is installed on one of the desktop Windows PC's I am monitoring:

$installed = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | Select-String -Pattern "PRTG" | Get-Unique | Measure-Object -line
write-host $installed.Lines

I tested this on one of the target machines and got the integer 1 back, as expected. However, the script appears to be getting the result off the core server, not the machine the sensor is under. I tried changing the program in Select-String to check for a program that is only on the core server, and sure enough it reported that correctly.

I want to check the target computer for the installed programs, so I'm not sure what I'm doing wrong

custom-sensor powershell prtg

Created on Jun 27, 2018 7:11:07 PM

Last change on Jun 28, 2018 6:54:28 AM by  Luciano Lingnau [Paessler]

2 Replies

Accepted Answer



Hello there,
thank you for your inquiry.

You're absolutely correct in your observations. The script is running on the Core because the sensor was deployed on the Local Probe. This is expected, since PRTG runs all sensors on the corresponding probe.

What needs to be done, is improve your script so that it can talk to remote hosts (and configure PRTG to pass the host as command-line parameter when it runs the script, using the %host variable in the parameters field).

There are two ways to do this:

  1. Use the -computername parameter, to run the cmdlet against a remote system (not all cmdlets support this)
  2. Use "Invoke-Command" to run everything remotely.

Please keep in mind that in both cases, you also need to take authentication into consideration, since the probe service runs scripts with the LOCAL_SYSTEM account by default (so this is the security context, when the script runs).

Please refer to the following KB-Post, as it refers to a very similar case where a different customer ran into this issue, and shared his final working script with necessary adjustments:

The following KB-Post also contains tips and tricks to get powershell-based sensors runnning:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jun 28, 2018 7:08:56 AM by  Luciano Lingnau [Paessler]



Thanks for your help! Decided to go with a Python script instead but the references will be useful for later on.

Created on Jun 28, 2018 10:19:38 PM

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.