Desktop Pool Information

This post was originally published on this site

Hi guys,

 

I am trying to make a script with two requirements

 

1) Get the count of total , available , connected and disconnected sessions of single desktop pool.

2) Get the  usernames and duration of the connected session in that desktop pool.

 

Am done with first point and dont know how to do with the second.

 

Here is what I did:

 

$pool = Read-host “Enter the pool name”

$tmp = Get-HVPool -PoolName $pool | Select -ExpandProperty base | Select -expandproperty name | % {Get-HVMachineSummary -PoolName $_| Select -ExpandProperty base | Select name,basicstate}

$Results = New-Object PSObject -Property @{

        “Available” = ($tmp | where {$_.basicstate -eq “AVAILABLE”});

        “Connected” = ($tmp | where {$_.basicstate -eq “CONNECTED”});

        “Disconnected” = ($tmp | where {$_.basicstate -eq “DISCONNECTED”});}

$Available = ($Results.Available).Count

$Connected = ($Results.Connected).Count

$Disconnected = ($Results.Disconnected).Count

$Total = $tmp.Count

write-host “Total Systems in the pool are:” $Total

write-host “Available Systems in the pool are:” $Available

write-host “Connected Systems in the pool are:” $Connected

write-host “Diconnected Systems in the pool are:” $Disconnected

#End

 

Any Help?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.