Before version 7.2.39.0.334 of the Progress Kemp PowerShell wrapper, the output format did not have a defined standard - each commandlet had variable structure and output.

In the 7.2.39.0.344 version of the wrapper, improvements were made to the output structure. All commands (except Test-LmServerConnection) return a PowerShell object with the following structure:

Note: The Test-LmServerConnection command returns True if the LoadMaster is reachable by the API, False if not (or if the API interface is disabled on the LoadMaster).

  • ReturnCode (integer)

  • Response (string)

  • Data (PowerShell object, if any)

Note: As a result of the new object structure, the current Progress KempPowerShell wrapper is not compatible with scripts written based on an older version of the Progress Kemp PowerShell wrapper (before version 7.2.39.0.344).

The possible values for the ReturnCode field are:

  • 200: The command completed successfully

  • 4xx/500: The command ended with an error. The error code depends on the error type.

The possible values for the Response field are:

  • Command successfully executed

  • Description of the error when the command fails, for example Unknown parameter value lmversion.

The Data field contains the response, if any. The structure of this field depends on the command. The elements of this field can be accessed by assigning the command to a variable and using the “dot” notation (for example, $lm_Version.Data.version in the example below). The next argument is listed by PowerShell after you enter the dot, for example, Data, Response, or ReturnCode, depending on the data in the variable. The dot can be used multiple times to focus on certain information, for example, $lm_Version.Data.version.Length. If the command fails, this field is empty.

Example 1: Retrieve the installed LoadMaster firmware version:

$lma = Get-LmParameter -Param version -LoadBalancer 172.21.59.189 -SubjectCN user1
$lma | Format-List
ReturnCode : 200
Response   : Command successfully executed.
Data       : @{version=7.2.59.0.21866.DEV}

$lm_Version.Data.version
7.2.59.0.21866.DEV

Example 2: Retrieve the available licenses for a specific Order ID:

$licDet = Get-LicenseType -KempId jbloggs@kemptechnologies.com -Password ExamplePassword -LoadBalancer 172.21.59.85 -Credential bal -OrderId Example20170517
$licDet | Format-List
ReturnCode : 200
Response   : Command successfully executed.
Data       : @{License=System.Object[]}
 
$licDet.Data.License
id            : 0632b88b577c71591798268bcd4e01132f082309
name          : VLM-5000 ESP GEO with Basic 2 Years
available     : 1
description   : VLM-5000 ESP GEO with Basic 2 Years
tethered      : False
LicenseStatus : Permanent License
BuyMoreAt     : https://www.kemptechnologies.com/buy-me-now?KempID= jbloggs@kemptechnologies.com
id            : fc488d991cffb7a5958625427d6bfb0b3edc008e
name          : VLM-5000 WAF GEO with Basic 3 Years
available     : 1
description   : VLM-5000 WAF GEO with Basic 3 Years
tethered      : False
LicenseStatus : Permanent License
BuyMoreAt     : https://www.kemptechnologies.com/buy-me-now?KempID= jbloggs@kemptechnologies.com
name          : VLM-5000 with Enterprise Plus subscription
available     : 1
tethered      : 0
id            : 3eb92178611573946b422cf8d0df69d04c07fede
LicenseStatus : Temp License
description   : VLM-5000 with Enterprise Plus subscription
BuyMoreAt     : https://www.kemptechnologies.com/buy-me-now?KempID= jbloggs@kemptechnologies.com

In the above example, the $licDet.Data.License is an array and each single element of the array can be accessed using the “[]” notation. For example, to access the field name of the second element of the previous array we have to use the following notation: $licDet.Data.License[1].name. The index of the array starts from 0. The NULL object is returned if we try to access a non-existing element.

The benefits of the structure of the command answers are:

  • It is easy to check for success/error (ReturnCode)

  • There is a short description (Response)

  • The Data field returns a PowerShell object when successful and null when there is an error