Thursday, March 5, 2015

Citrix Desktop Available

add-pssnapin Citrix.Broker.Admin.* -ErrorAction SilentlyContinue





clear



$DBG = Get-BrokerDesktopGroup | where {$_.Name -eq "IT" -and $_.Enabled -eq "True"}




#[Uint16] $TD

#[Uint16] $DIU


$TD = $DBG.TotalDesktops

$DIU = $DBG.DesktopsInUse

$DD = $DBG.DesktopsDisconnected

$sobj = Get-BrokerDesktop | Where{$_.PowerState -eq "Off"}|Measure-Object -Line -Property PowerState | Select-Object Lines

$poweredoffdesktops = $sobj.Lines

If ($TD -and $DIU -and $Poweredoffdesktops -and $DD -ne "null")



{

$PAvail = ($TD-($DD+$DIU))

$Avail = $PAvail - $poweredoffdesktops

Write-Host "Total Desktop Available:"$Avail"|DesktopAvailble="$Avail";0;$TD"



exit(0)

}

else


{

Write-Host "Unable to fetch the Get-BrokerDesktopGroup, please contact Chethan or Babu"



exit(2)

}

 


No comments:

Post a Comment