Enterprise Mobility and Security Blog

RSS

Terminal Services Per User Licensing Usage Tracking

Prior to “Windows Server 2008” there was no way for administrators to check the usage of Terminal Services per user licenses. Terminal Services licensing in Windows Server 2008 Beta 3 enables administrators to track the usage of Terminal Services per user licenses. Administrators can generate a per user license usage report that contains the number of licenses issued by a particular license server and the total number of per user licenses available on that server, to make sure that license usage is in line with the EULA and licensing agreements.

Per user license usage reports can be generated across three different scopes:

1. Domain : Generates a per user usage report across the host domain of a Terminal Services Licensing Server (TSLS)

2. Organizational Unit (OU): Generates a per user license usage report across the given OU in the host domain of a TSLS

3. All Trusted Domains: Generates a per user license usage report across all trusted domains

Reports are accessible through the following mechanisms:

· TS Licensing Manager

· WMI providers

Managing Reports using TS Licensing Manager:

In Windows Server 2008, a new option in the TS Licensing Manager menu named “Create Report” can be used to generate and manage per user license usage reports.

To create a per user license usage report

1. Open TS Licensing Manager (LicMgr.Exe)

2. Right-click the license server name for which you want to generate the report, and then select the “Create Report” and “Per User CAL Usage …” options.

3. Select the scope for which you want to generate the report. (These are described above.)

To view summaries of generated reports, use the License Manager UI.

You can perform various operations on the generated reports:

1. The “Delete Report” option deletes the report.

2. The “Save As” option saves the usage report in a readable format. This is useful if you want to check users to whom licenses have been issued. To do this, first generate a report and then click “Save As” to give it a new name. Then open the report to review which users received licenses from that TSLS.

Here’s an example of a usage report:

Managing Reports using WMI Providers:

Windows Server 2008 also provides support for managing Per User usage reports using WMI providers. Now, an administrator can write a simple script to generate a usage report for a given scope. Within the script, he can take further action based on the reports. For example, if the number of issued licenses exceeds the number of installed licenses, the script can send an e-mail to the administrator.

Reports generated using WMI are displayed in the TS Licensing Manager, and reports deleted using WMI are also deleted from the TS Licensing Manager.

The following WMI classes are used to generate reports.

Win32_TSLicenseReport:

Windows Server 2008 has a WMI class named “Win32_TSLicenseReport” for managing per user license reports.

This WMI class provides three different interfaces to manage reports:

i. GenerateReport: This interface is used for generating per user license usage reports. Reports can be generated across three different scopes as discussed above. This is a static function.

The syntax of the API is

uint32 GenerateReport ( [in] uint32 ScopeType,

[in] string ScopeValue,

[out] string FileName);

Where

ScopeType: Defines the scope for which the report needs to be generated

1 -> Domain

2 -> Organizational Unit (OU)

3 -> All trusted Domains

ScopeValue: This is used only when ScopeType is “Organizational Unit (OU)”,

It should contain the name of the OU for which you want to generate the report in the format “OU=OUName”

FileName: This is an output parameter containing the file name of the report generated. This file name can be used to perform other operations on the report like Delete and FetchReport.

ii. DeleteReport: This interface is used to delete an existing per user usage report. This is not a static function and must be called from the per user report object.

The syntax of the API is

uint32 DeleteReport ( )

iii. FetchReportEntries: This interface is used to get the user name and other information from a per user usage report. This tool is not a static function and must be called from a per user usage report object.

The syntax of the API is

uint32 FetchReportEntries ( [in] uint32 StartIndex,

[in,out]        uint32 Count,

[out]         Win32_TSLicenseReportEntry ReportEntries[]);

Where

StartIndex -> Index to start from

Count -> Number of values to be fetched;

If you need to fetch all entries then set StartIndex=0 and Count=0.

ReportEntries -> Array of the objects of Win32_TSLicenseReportEntry; These object contains DomainNameUserName, License Expiry date, Product Version

For more information, see Win32_TSLicenseReport.

Win32_TSLicenseReportEntry:

The Win32_TSLicenseReportEntry class provides details of the Per User Licenses issued. This class has three members:

User: User to which the license was issued

ExpirationDate: Expiration date of the license

ProductVersion: Per user license version

For more information, see Win32_TSLicenseReportEntry.