4 Replies Latest reply on Dec 8, 2017 1:24 PM by csensbach

    Powershell Component Monitor - Return a list?


      Hello, I am new to setting up component monitors so I am not sure if what I want to do is possible.


      I would like to run a Powershell script that polls our RD Gateway servers and returns a list of users that are currently connected through the Gateway as well as the number of people connected. I have no problem getting the script to return the number of people connected but I cannot get it to return an array of values. It seems that it only wants to return a single line.


      My ultimate goal is to setup a view in Solarwinds which will display this information for each Gateway server.


      I have tried returning a single varaiable that contains the entire array as well as trying to return each line, one by one (which is below). Neither worked.


      #number of sessions on the gateway

      $numSessions = 0


      #Cycle through each connection

      foreach ($curitem in (Get-WmiObject -class "Win32_TSGatewayConnection" -ComputerName servername -namespace "root\cimv2\TerminalServices") ) {

           $returnVal = $curitem | select username
           Write-Host "Message.$numSessions : $returnVal"



      Write-Host "Statistic.List: $numSessions"
      exit 0;



      Is what I want to do possible? If so, how do I return a list of values? If not, is there another way to do Powershell reporting through Solarwinds that I have overlooked.


      Thanks in advance for any help.