VMWare View, how to count active sessions

luca 01/06/2012 0

Today I needed to track the number of active sessions of a given virtual desktop pool in my VMWare View infrastructure.

VMWare offers some cmdlets to Powershell integration; you can find them on the server where the Connection Server is installed:

You can include those cmdlets in your scripts with the command:

add-PSSnapin "VMware.View.Broker"

To get remote sessions, use Get-RemoteSession cmdlet, with the pool name as a parameter:

Get-RemoteSession -pool_id MyPool

Filter the retrieved objects based on their state (CONNECTED) and count the result:

|Where-Object{$_.state -eq "CONNECTED"}).Count

Finally save the value, with date and time.

Here’s the complete script:

add-PSSnapin "VMware.View.Broker"
(Get-Date).ToShortDateString() + " " + (Get-Date).ToShortTimeString() + " - " + ((Get-RemoteSession -pool_id MyPool)|Where-Object{$_.state -eq "CONNECTED"}).Count | out-file -FilePath "MyLog.txt" -Append

and the log file:

Leave A Response »

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.