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


Using powershell to return a value

Votes:

0

Your Vote:

Up

Down

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 by  chadleywilson (0) 1

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



3 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

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]



Votes:

0

Your Vote:

Up

Down

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 by  chadleywilson (0) 1



Votes:

0

Your Vote:

Up

Down

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]



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.