We had an issue today where we ran out of Citrix Licenses and therefore some of the users were unable to login, the Citrix License server seems to be a pretty basic app with alerting feature.
After purchasing and installing some licenses so that the users could gain access to there applications again we started thinking about ways to monitor this so it didn’t happen again.
I was sure we could monitor this using powershell and started to look into it, first thing I came across was a BSonPoSH article explaining how to get license information from WMI, that guy has done some impressive stuff with Citrix and powershell, check it out on his site.
Ok, so all looked fine and dandy, until we ran it and found that one of our licenses was not showing in the figures 🙁
Looking into it a bit more and exploring WMI gave us the same results, one of the licenses was missing. Sod’s law says it was the one we were after too !
Looking on the Internet again it would seem this is a “known problem” which there is a private fix for.
Not to be beaten I thought of other ways to get this information, I know I had pulled information from websites before so decided to try and access the information direct from the license web page.
Looking at the html code that was dumped, it was changing, this made it hard to just read the specific lines I wanted, so as you can see from the code I searched for the license type I wanted ‘Enterprise’ and then worked out where the figures are that I needed from there.
If nothing, this is a useful script to see how to retrieve html information and work with it to get the end results.
Run it normally and if the License usage is above 90% it will fire off an email or run it with the send parameter to send an email anyway.
Any comments or quires please leave a comment below.