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
Article Comments
Hi Timo,
This is great, we now have it working. Thank you very much.
Kind regards Chad
Mar, 2020 - Permalink
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
Mar, 2020 - Permalink