PoshCode Logo PowerShell Code Repository

Get-UnityLicense by rfoust 5 years ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/750"></script>download | new post

This function connects via HTTP to a Cisco Unity server and returns license information as a PSCustomObject.

  1. #
  2. # get-unitylicense.ps1
  3. #
  4. # Returns license information for a Cisco Unity environment
  5. # Usage: get-unitylicense <server>
  6. #
  7. # Author: Robbie Foust (rfoust@duke.edu)
  8. #
  9.  
  10. function global:get-unitylicense ([string]$server = $(throw "Please provide a server name!"))
  11.         {
  12.  
  13.         $webContent = new-object net.webclient
  14.         $page = $webContent.DownloadString("http://$server/avxml/effectivelicense.asp")
  15.  
  16.         # remove leading whitespace
  17.         $page = $page -replace "^.`n"
  18.         $license = [xml]$page
  19.  
  20.         new-object psobject | add-member -memberType NoteProperty -name LicLanguagesMax -value $license.AvXmlLicData.Licenses.LicLanguagesMax -passthru |
  21.                 add-member -memberType NoteProperty -name LicMaxMsgRecLenIsLicensed -value $license.AvXmlLicData.Licenses.LicMaxMsgRecLenIsLicensed -passthru |
  22.                 add-member -memberType NoteProperty -name LicPoolingIsEnabled -value $license.AvXmlLicData.Licenses.LicPoolingIsEnabled -passthru |
  23.                 add-member -memberType NoteProperty -name LicSubscribersMax -value $license.AvXmlLicData.Licenses.LicSubscribersMax -passthru |
  24.                 add-member -memberType NoteProperty -name LicUMSubscribersMax -value $license.AvXmlLicData.Licenses.LicUMSubscribersMax -passthru |
  25.                 add-member -memberType NoteProperty -name LicVMISubscribersMax -value $license.AvXmlLicData.Licenses.LicVMISubscribersMax -passthru |
  26.                 add-member -memberType NoteProperty -name LicVoicePortsMax -value $license.AvXmlLicData.Licenses.LicVoicePortsMax -passthru |
  27.                 add-member -memberType NoteProperty -name AvLicUtilizationSecondaryServer -value $license.AvXmlLicData.Utilization.AvLicUtilizationSecondaryServer -passthru |
  28.                 add-member -memberType NoteProperty -name AvLicUtilizationSubscribers -value $license.AvXmlLicData.Utilization.AvLicUtilizationSubscribers -passthru |
  29.                 add-member -memberType NoteProperty -name AvLicUtilizationVMISubscribers -value $license.AvXmlLicData.Utilization.AvLicUtilizationVMISubscribers -passthru
  30.         }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me