There is no quick way to determine the load of a farm with the remote desktop services manager (RDS manager). To get the number of users on each server of a farm, you have to click on each server and then count the number of users on that server. There is no total users count in RDS manager. If you’re environment is dynamic, it’s also hard to keep the groups up to date in the RDS manager. You can import from the connection broker every time, but to see the number of users on each server, you first have to connect to it. In the RDS manager, there’s also no information available about system resources like memory usage on the farm server. Luckily this all can be done with a little from powershell.

Here is the way to get it using the Remote Desktop manager, first import all the farms from connection broker:



after that, for each server in each farm: select server wait for the communications check, and then connect:



And here is how you can doe this by using powershell. There is a powershell module called RemoteDesktopServices, which once imported, it offers a couple of cmdlets for RDS services. One of which is the ability to view the RDS settings as if it where a drive. Get-Childitem RDS:\RDSfarms for example shows all the known farms. And Get-ChildItem RDS:\RDSfarms\{Farmname}\servers shows all the registered servers in that farm. To view the number of sessions, just look at RDS:\RDSfarms\{Farm Name}\servers\numberOfSession. This makes it easy to get the session and server information, but the drawback of this method is, taht it only works when you execute this command on a connection broker. Fortunately there is another way to do this, and you even don’t have to load the RemoteDesktopServices module. These values are also visible through WMI, using Win32_SessionDirectoryCluster and Win32_SessionDirectoryServer.The memory usage can be retrieved through the Win32_OperatingSystem WMI object. Below is a script which (assuming the user has enough rights) connects to the session broker, retrieves a list of all known farms on that broker. It list all farm member servers with the number of sessions and the amount of available and installed physical memory. the output is written to a .log file, but this could easily be changed to any other desired format.

For this script to work, you’ll need to enable powershell to run scripts. More information on this can be found on technet

Lines starting with # are comments explaining what the code does.


# Just enter the name of the connection broker here

$Connectionbroker = “name of connection broker machine”

# The location and name of the output file
$X= (Get-Item env:tmp).value+”\silo.log”

# Getting all the farm names from the connection broker
$silos = Get-WMIObject -ComputerName $ConnectionBroker -Class Win32_SessionDirectoryCluster

# Getting all the servers for each farm found

foreach ($silo in $silos)

# store Farmname so it can be used

$Farmname = $silo.clustername

# Get a list of all the servers in the current farm

$servers = Get-WMIObject -ComputerName $ConnectionBroker -Class Win32_SessionDirectoryServer -Filter “ClusterName=’$FarmName'”

# Writing output to file

add-content $x ” ”
add-content $x “$Farmname”

# Get the performance numbers from the servers found
foreach ($server in $servers)
$sessions = $server.NumberOfSessions
$servername = $Server.ServerName

$memwaarden = Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName $servername
$tm = ($memvalues.TotalVisibleMemorySize / 1048576)
$memTOT = ‘{0:N2}’-f $tm
$tm = ($memvalues.FreePhysicalMemory / 1048576)
$memFree = ‘{0:N2}’-f $tm

# Write these values to the output file

add-content $x “$Servername `t Users: `t $sessions `t Memory: $memTOT GB `t availible: $memFree”

# Opening the results in notepad, using ping to delay the delete.
notepad $X
ping localhost
del $x

I found that this is a fast and easy way to get the load. And after taking a look at Server 2012, it will be for quite some time.

Comments are closed.