References > Template Reference > Remote Desktop Services Licensing

Remote Desktop Services Licensing

This template assesses the status and overall performance of a Remote Desktop Services Licensing (Microsoft Terminal Licensing Server). This template uses Windows System Event Log, Windows Service, and PowerShell monitors. This template works on Windows 2003, 2008, 2008 R2, 2012, 2012 R2.

Prerequisites

  • WMI access to the target server;
  • Windows Server 2003 Resource Kit Tools should be installed on Terminal Licensing Server
  • WinRM should be properly configured on target server.

Credentials

Windows Administrator on the target server.

Monitored Components

For details on monitors, see SAM Component Monitor Types.

All Windows Event Log monitors should return zero values. Returned values other than zero indicate an abnormality. Examining the Windows System log file, with “TermServLicensing” and “TerminalServices-Licensing” source names, should provide information pertaining to the issue.

Detailed information about all these events can be found here:

Licenses Usage

This monitor returns license usage statistics by running the lsreport tool from the Windows Server 2003 Resource Kit Tools. In the message fields, this component returns which machine connection is initialized (Client), which user currently uses a license (User), the License Type, and when the connection ends. Returned values are as follows:

  • Temporary – This component returns the number of currently used Temporary licenses. Temporary licenses are given out when a client connects for the first time.
  • Active – This component returns the number of currently used Active licenses. On the second connection and on successful logon, the client gets an Active license.
  • Upgraded – This component returns the number of currently used Upgraded licenses. Windows 2000 licenses that were upgraded to a Windows 2003 license is called Upgraded.
  • Total Used – This component returns the total number of currently used licenses.

This monitor uses the following arguments: path_to_lsreport, target_server:

path_to_lsreport – This is the full path to the lsreport.exe file. If the Windows Server 2003 Resource Kit Tools installed in the default location, this argument should be as follows:

For x86 Windows: C:\Program Files\Windows Resource Kits\Tools\lsreport.exe;
For x64 Windows: C:\Program Files (x86)\Windows Resource Kits\Tools\lsreport.exe.

target_server – This is the IP address of the target server. It should be: ${IP}.

Argument example:

C:\Program Files\Windows Resource Kits\Tools\lsreport.exe, ${IP}

Service: Remote Desktop Licensing

This monitor returns the CPU and memory usage of the Remote Desktop Licensing server (Terminal Licensing Server on 2003). This service provides registered licenses for Remote Desktop Services clients. If this service is stopped, the server will be unavailable to issue Remote Desktop Services licenses to clients when they are requested.

Events: Startup Errors

This monitor returns the number of events that occur when:

  • There is a Work Manager or Cannot Startup Work Scheduler error;
  • The Terminal Services Licensing service could not create the service initialization thread;
  • The Terminal Services Licensing service could not start due to a lack of system resources;
  • The Terminal Services Licensing service cannot start due to an error;
  • An error occurred during the Terminal Services license server initialization phase;
  • The remote procedure call (RPC) port is not listening;
  • TS Licensing is unable to allocate the required system memory to perform the operation;
  • Cannot initialize policy module because of an error;
  • A security descriptor cannot be set. As a result, terminal servers might not be able to connect to Terminal Services license servers.

Type of event: Error and Warning. Event ID: 43, 30, 36, 37, 4097, 4104, 4117, 41, 4142.

For Work Manager or Cannot Startup Work Scheduler errors, review the following article for more information: http://support.microsoft.com/kb/310122.

Terminal Services Licensing service: If the service initialization thread cannot be created, or a lack of system resources events exist, you should increase the amount of available memory on the Terminal Services license server.

Terminal Services Licensing service: If this service cannot start due to an error event, ensure that the required groups are granted the correct permissions to the TermServLicensing registry key and that the value of the DBPath registry key matches the location of the LServer directory. If the problem persists, shut down and then restart the Terminal Services license server.

  • For an error that occurred during the Terminal Services License Server Initialization Phase event, start the Terminal Services Licensing service, and if necessary, remove and then reinstall TS Licensing.
  • For the remote procedure call (RPC) port is not listening event, verify that the Terminal Services license server is available and ensure that the Terminal Services Licensing service is running.
  • For the Cannot Initialize Policy Module events, ensure that the Terminal Services Licensing registry key contains the following correct settings:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TermServLicensing\Policy\MicrosoftCorporation\A02, and the registry subkey contains the following entry: String Name: DLL; String Value: %systemroot%\System32\tls236.dll.
  • For Security Descriptor Cannot Be Set events, restart the Terminal Services Licensing service.

Events: License Errors

This monitor returns the number of events that occur when:

  • Cannot generate a license for client because of an error;
  • Terminal Services Licensing on the server has not been activated. Terminal Services Licensing will only issue temporary licenses until the server is activated;
  • The Terminal Services Licensing server has no license pack registered product;
  • The Terminal Server Licensing server has no permanent licenses for the product;
  • A license could not be issued because it is not a member of the Terminal Server Computers group;
  • One or more Terminal Services Licensing certificates on server are corrupt.

Type of event: Error and Warning. Event ID: 38, 18, 22, 21, 45, 17.

  • For Cannot Generate A License For Client Because Of Error events, review this event in the Windows Event Monitor for details.
  • For the Terminal Services Licensing On Server Has Not Been Activated events, activate your Terminal Services Licensing server.
  • For the Terminal Services Licensing Server Has No License Pack Registered Product events: Use Terminal Services Licensing administrative tool to register the license pack.
  • For the Terminal Server Licensing Server Has No Permanent Licenses For Product events, use the Terminal Server Licensing administrative tool to register more licenses.
  • For A License Could Not Be Issued To Because It Is Not A Member Of The Terminal Server Computers Group events, check the status of the License Server Security Group. If the status is set to Enabled, a local group called Terminal Services Computers is created. The Terminal Server License Server grants licenses only to computers whose computer accounts are placed in this group. When the target computer is a domain controller, this group is a domain local group. If the status is set to Disabled, the Terminal Server License Server issues a license to any computer that requests one. The Terminal Services Computers group is not deleted or changed in any way. This is the default behavior. If the status is set to Not Configured, the Terminal Server License Server acts the same as if the status is set to Disabled. If you did not add any clients to this group, any machine attempting to connect to the terminal server would be denied.
  • For one or more Terminal Services Licensing certificates on server are corrupt events: you should reactivate this TS Licensing server or this RD Licensing server.

Events: Database Errors

This monitor returns the number of events that occur when:

  • Cannot connect to the database;
  • General database error occurred.

Type of event: Error and Warning. Event ID: 7, 44.

Refer to this article for more information: http://www.virtualizationadmin.com/articles-tutorials/terminal-services/licensing/troubleshooting-terminal-server-licensing-issues-part3.html.

Events: Service Stopped

This monitor returns the number of events that occur when:

  • The Terminal Services Licensing service has stopped;
  • TS Licensing has experienced a general initialization failure.

Type of event: Error and Warning. Event ID: 3, 4115.

For these events, start the Terminal Services Licensing service, and if necessary, remove and then reinstall TS Licensing.

Events: Connection Errors with SCM

This monitor returns the number of events that occur when:

  • The Terminal Services Licensing service is unable to connect to the Service Control Manager;
  • The Terminal Services Licensing service is unable to report status to the Service Control Manager.

Type of event: Error and Warning. Event ID: 27, 28.

For these events, restart the Terminal Services Licensing service, and if necessary, restart the server.

Configuring Windows Remote Management (WinRM)

If not already done so, install PowerShell 2.0 and WinRM on the SAM and target servers. Powershell 2.0 can be found here: http://support.microsoft.com/kb/968930.

  1. On the SAM server, open a command prompt as an Administrator. To do this, go to the Start menu and right-click the cmd.exe and then select Run as Administrator.
  2. Enter the following in the command prompt:
    winrm quickconfig
    winrm set winrm/config/client @{TrustedHosts="*"}
  3. On the target server, open a command prompt as an Administrator and enter the following:
    winrm quickconfig
    winrm set winrm/config/client @{TrustedHosts="IP_ADDRESS"}
    where IP address is the IP address of your SAM server.