Posts RSS Comments RSS 117 Posts and 170 Comments till now

Citrix License Info (using WMI)

I had several questions about this so I decided I should figure it out and Post. It was surprisingly simple. All I needed was the WMI provider and from there it was cake. If you’re curious how I figured out the WMI namespace I used WMI Explorer from MoW [CLICK HERE To Read about it].

The Output will look like this
Citrix License Script Ouput

Here is the Code

  1. # Get-CitrixLicensing
  2. Param($LicenseServer)
  3. $licensePool = gwmi -class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -comp $LicenseServer
  4. $licensePool | Select-Object @{n="Product";e={$_.PLD}},
  5.                             @{n="Model";e={"Server"}},  
  6.                             @{n="Type";e={$_.LicenseType}},
  7.                             @{n="Installed";e={$_.Count}},
  8.                             @{n="In Use";e={$_.InUseCount}},
  9.                             @{n="Available";e={$_.PooledAvailable}},
  10.                             @{n="% in use";e={($_.InUseCount/$_.Count)*100}}

2 Responses to “Citrix License Info (using WMI)”

  1. on 29 May 2008 at 9:56 pmDLP

    Great script Brandon. Just what I needed. Will you please explain the second part of the script in how you use Select-Object to display the data? How does Select-Object know to grab each “Product” etc and group them together to display?

  2. on 30 May 2008 at 4:58 amtshell

    I used what is referred to as a calculated property. Effectively, you use select-object to “add” a property that doesn’t really exist, but its value is calculated from a script block “{…}.” Here are some good links that talk about calculated properties.
    http://bsonposh.com/archives/260
    http://bsonposh.com/archives/262
    and
    http://www.microsoft.com/technet/scriptcenter/resources/pstips/apr08/pstip0425.mspx

Trackback this post | Feed on Comments to this post

Leave a Reply

CAPTCHA image