Remote Desktop Services Licensing
This SAM application monitor template assesses the status and overall performance of Remote Desktop Services (RDS). This template uses Windows System Event Log, Windows Service, and PowerShell monitors.
In earlier versions of Windows Server, Windows Remote Desktop Services was called Terminal Services. To learn more, see this THWACK discussion.
Prerequisites
- WMI access to the target server;
- WinRM is configured on target servers.
Credentials
Windows Administrator rights on the target server.
Component monitors
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.
Licenses Usage
This component monitor is specific to the legacy Windows Server 2003 OS that is no longer supported.
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 – Returns the number of currently used Temporary licenses. Temporary licenses are given out when a client connects for the first time.
- Active – Returns the number of currently used Active licenses. On the second connection with a successful login, the client gets an Active license.
- Upgraded – Returns the number of currently used Upgraded licenses.
- Total Used – Returns the total number of currently used licenses.
This monitor uses the following arguments: path_to_lsreport, target_server
:
path_to_lsreport
– The full path to the lsreport.exe file. If the Windows Server 2003 Resource Kit Tools is 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
– The IP address of the target server. Use the following variable:${IP}
Example:
C:\Program Files\Windows Resource Kits\Tools\lsreport.exe, ${IP}
Service: Remote Desktop Licensing
Returns the CPU and memory usage of the service that registers licenses for RDS clients. If this service stops, the server cannot issue licenses to clients.
Events: Startup Errors
Returns the number of events that occur when:
- A Work Manager or Cannot Startup Work Scheduler error occurs;
- The service could not create the service initialization thread;
- The service could not start due to a lack of system resources;
- The service cannot start due to an error;
- An error occurred during the server initialization phase;
- The RPC port is not listening;
- The service cannot allocate the required system memory to perform the operation;
- The service cannot initialize a policy module because of an error;
- A security descriptor cannot be set. As a result, servers might not be able to connect to RDS 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, see Windows Server 2003 Terminal Server licensing issues and requirements for deployment. (© 2021 Microsoft Corp., available at docs.microsoft.com, obtained on May 20, 2022)
Terminal Services Licensing service: If the service initialization thread cannot be created, or a lack of system resources events exist, 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 required groups are granted 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 RPC port listening events, 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 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
Returns the number of events that occur when:
- A license for client cannot be generated because of an error;
- Terminal Services Licensing on the server is not activated. Terminal Services Licensing will only issue temporary licenses if 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 the 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 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 enabled, a local group called Terminal Services Computers is created. The Terminal Server License Server grants licenses only to computers whose accounts are placed in this group. If the target computer is a domain controller, this group is a domain local group.
- If 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 is denied.
- For one or more Terminal Services Licensing certificates on server are corrupt events, reactivate the TS Licensing server or RD Licensing server.
Events: Database Errors
Returns the number of events that occur when:
- A database connection fails, or
- General database error occurred.
Type of event: Error and Warning. Event ID: 7, 44.
Events: Service Stopped
Returns the number of events that occur when:
- The Terminal Services Licensing service stops;
- 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. If necessary, remove and then reinstall TS Licensing.
Events: Connection Errors with SCM
Returns the number of events that occur when the Terminal Services Licensing service:
- Cannot connect to the Service Control Manager;
- Cannot 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.