I created this Powershell script to monitor current VPN connections.
Try {
$rras = Get-RemoteAccessConnectionStatisticsSummary
}
Catch [system.exception]
{
}
Finally
{
$myxml = '<prtg>' + "`n" + '<result>' +
"`n" + '<channel>TotalVPNConnections</channel>' +
"`n" + '<value>' + $rras.TotalVpnConnections + '</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>' + ($rras.TotalBytesInOut/(1024*1024)) + '</value>' +
"`n" + '</result>' + "`n" + '<result>' +
"`n" + '<channel>TotalCumulativeConnections</channel>' +
"`n" + '<value>' + $rras.TotalCumulativeConnections + '</value>' +
"`n" + '</result>' + "`n" + '</prtg>'
$myxml
}
I use the Invoke method if is it on a remote server
$xmlresult = Invoke-Command -ComputerName <<COMPUTERNAME>> -FilePath "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\rras-connections.ps1"
$xmlresult
Add comment