pixel0815
Goto Top

Powershell Citrix Lizenzserver - Verbauch der Lizenzen monitoren

Hallo liebe Gemeinde,

ich habe ein Skript auf der Pässler Seite gefunden und versuche es den morgen schon über zu bearbeiten das ich mehrere Lizenzpools damit abfragen kann.
Dies gelingt mir nicht so richtig face-sad


innerhalb dieser Abfrage

$LicensePool | ForEach-Object{ If ($_.PLD -eq "MPS_ENT_CCU"){  
    $Total = $Total + $_.count
    $InUse = $InUse + $_.InUseCount
    }
}

möchte ich einen weiteren Lizenzpool abfragen und zu dem Ergebnis hinzuzählen.

Wir verwenden MPS_ENT_CCU und XDT_ENT_UD
Wie kann ich dies realisieren?

Gruß
Heiko

Hier das Skript.
http://kb.paessler.com/en/topic/29223-how-can-i-set-up-a-monitor-for-ci ...


# Setup Variables
$Total = 0
$InUse = 0
$PercentUsed = 0
$Retstring = 0
$RetValue = 0

# Get Citrix licensing Info
# Use the IP address of the License server(-comp switch).  I got inconsistent results using the hostname
$licensePool = gwmi -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp Ip-Adresse  

# This will display all the license info....Uncomment for troubleshooting
# $licensePool | Select-Object @{n="Product";e={$_.PLD}}, 
#                            @{n="Installed";e={$_.Count}}, 
#                            @{n="In Use";e={$_.InUseCount}}, 
#                            @{n="Available";e={$_.PooledAvailable}}, 
#                            @{n="% in use";e={($_.InUseCount/$_.Count)*100}} 
                            
# This loops through all the license info and adds up the total license count and in use count for MPS_ENT_CCU licenses
# If you do not have MPS_ENT_CCU licenses, uncomment the section above and look at the output.  Figure out your license count from that.  Edit Script as needed                            
$LicensePool | ForEach-Object{ If ($_.PLD -eq "MPS_ENT_CCU"){  
    $Total = $Total + $_.count
    $InUse = $InUse + $_.InUseCount
    }
}

#  Uncomment to confirm values are correct    
# "Total = ", $Total 
# "In Use = ", $Inuse 

$PercentUsed = [Math]::Round($inuse/$total*100,0)

#  Determine return code.  Less than 90%, ok, 90-97 Warning, 98-100 Error
switch ($PercentUsed)
    {
        {$PercentUsed -lt 90} {
            $RetString = [string]$Inuse+":OK"	  
            $RetVal = 0
            break
            }
        {$PercentUsed -ge 90 -and $PercentUsed -lt 98} {
            $RetString = [string]$Inuse+":Warning 90-97% License Usage"	  
            $RetVal = 1
            break
            }
        {$PercentUsed -ge 98} {
            $RetString = [string]$Inuse+":ALERT 98-100% License Usage"	  
            $RetVal = 2
            }
}

# Return Info
Write-Host $RetString
exit $RetVal

Content-Key: 271450

Url: https://administrator.de/contentid/271450

Printed on: April 25, 2024 at 07:04 o'clock

Mitglied: 114757
Solution 114757 May 08, 2015 updated at 07:48:31 (UTC)
Goto Top
$LicensePool | ?{$_.PLD -eq "MPS_ENT_CCU" -Or $_.PLD -eq "XDT_ENT_UD" } | %{  
    $Total += $_.count
    $InUse += $_.InUseCount
}
Gruß jodel32
Member: pixel0815
pixel0815 May 08, 2015 at 07:48:58 (UTC)
Goto Top
Hallo Jodel,

Vielen Dank!! :o)
Top!!!

Gruß
Heiko