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

Using powershell to return a value



This is my script and for hours on end I have been reading through the PRTG knowledge base and user forums and I must be the only person on earth stupid enough to try something so basically simple in powershell and prtg.

$NU = Get-Content \\myserver\DirectAccess\DAcount.txt -First 1
$count3 = [System.Decimal]::Parse($NU)
$returnvalue = $count3.ToString() +":Connected Users"
Write-Host $returnvalue
exit 0

This is my script we are trying to get the value in the TXT file into PRTG.

I have tried the following

Write-Host "$count3:Connected Users"
exit 0
# and 
Write-host $count3":Connected users"
# and 
write-host $count3, "Connected users"
# and 
write-host "$count3", "Connected users"
# and 
write-host '$count3' + ": Connected users"
# and 
write-host "$count3" + ": Connected users"
# and 
write-host $count3 + ": Connected users"

I have tried to understand what this means value:message but there are no working examples except for shh examples but I as I am using powershell I can't get this to work.

This is NOT covered in the manual. Please could you or someone provide me with assisance. on the last part please, how do you display the value inthe $count3 variable in PRTG

custom-script-exe powershell script

Created on Mar 23, 2020 4:55:45 PM

Last change on Mar 23, 2020 7:41:38 PM by  Stephan Linke [Paessler Support]

3 Replies




If you can retrieve your desired value in the $count3 variable already, please try the following to display the value in PRTG:

write-Host "$($count3):Connected Users"

Is this working?

Kind Regards,
Timo Dambach
Paessler Tech Support

Created on Mar 24, 2020 9:34:48 AM by  Timo Dambach [Paessler Support]



Hi Timo,

This is great, we now have it working. Thank you very much.

Kind regards Chad

Created on Mar 24, 2020 9:50:42 AM



You're welcome, Chad. I'm glad it's working now :)

Created on Mar 24, 2020 10:03:35 AM by  Timo Dambach [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.