Hi There,

We have a lot of users working from home and I notice our Direct Access Statistics.ps1 script is not out putting any results to PRTG? This is the script:

 Try {
$DAC = Get-RemoteAccessConnectionStatisticsSummary -ComputerName DASERVER } Catch [system.exception] { } Finally { 
$myxml = '<prtg>' + "`n" + '<result>' + "`n" + '<channel>TotalConnections</channel>' + "`n" + '<value>' + $DAC.TotalConnections + '</value>' + "`n" + '</result>' + "`n" + '<result>' + "`n" + '<unit>Custom</unit>' + "`n" + '<Customunit>MB</Customunit>' + "`n" + '<VolumeSize>MegaByte</VolumeSize>' + "`n" + '<Float>1</Float>' + "`n" + '<channel>Total Bytes In Out</channel>' + "`n" + '<value>' + ($DAC.TotalBytesInOut/(1024*1024)) + '</value>' + "`n" + '</result>' + "`n" + '<result>' + "`n" + '<channel>MaxConcurrentConnections</channel>' + "`n" + '<value>' + $DAC.MaxConcurrentConnections + '</value>' + "`n" + '</result>' + "`n" + '</prtg>' 
$myxml 
}

Now when I run the .ps1 script manually in Powershell ICE it outputs a value correct

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Direct Access Statistics.ps1
<prtg>
<result>
<channel>TotalConnections</channel>
<value>838</value>
</result>
<result>
<unit>Custom</unit>
<Customunit>MB</Customunit>
<VolumeSize>MegaByte</VolumeSize>
<Float>1</Float>
<channel>Total Bytes In Out</channel>
<value>498874.701332092</value>
</result>
<result>
<channel>MaxConcurrentConnections</channel>
<value>844</value>
</result>
</prtg>

Any Ideas?


Article Comments

Dear CallumWalker,

if the output works from the command line, please check in PRTG if the correct security context is set in the sensor settings and if the Windows device credentials are correct. For further debugging, you can enable the sensor option "Write Exe result to disk". After the next sensor scan, the sensor log appears in the log folder, default path "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)".


Mar, 2020 - Permalink

I've tried to set the Credentials for Windows Systems with both my Admin and the PRTG service account with no luck. The "Write Exe result to disk" was turned on but I couldn't see any results. Please can i log a support ticket for this.


Mar, 2020 - Permalink

Dear CallumWalker,

please contact us through the webinterface, Setup / Contact Support, with the Support Bundle option. In case the bundle cannot be send, contact us at support@paessler.com and reference this case.


Mar, 2020 - Permalink

Note: Opening a new Powershell session (new-PSSession) to the target system within the script (before the actual code) seems to work.


Kind Regards,
Timo Dambach
Paessler Tech Support


Aug, 2020 - Permalink