Quantcast
Channel: Questions Tagged “script” — Paessler Knowledge Base
Viewing all articles
Browse latest Browse all 87

Using powershell to return a value

$
0
0

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


Viewing all articles
Browse latest Browse all 87

Trending Articles