Hardware

Step-By-Step: Monitor Terminal Services licenses with Lsreport.exe

Learn to use Terminal Services License Reporter (Lsreport.exe), a command-line tool included in Microsofts Windows 2000 Server Resource Kit


Microsoft's Windows 2000 Server Resource Kit offers two tools designed to help administrators manage Windows 2000 Terminal Services Licensing. These tools are essential if you run Windows 2000 Terminal Services in application server mode. This article will cover Terminal Services License Reporter (Lsreport.exe), a command-line tool, while my next article will look at Terminal Services License Server Viewer (Lsviewer.exe), a GUI tool.

Terminal Services licensing
Once you set up Terminal Services in application server mode, you have a 90-day grace period to activate a Terminal Services license server (obtain a machine certificate from Microsoft’s Clearing House). If you don't do this, clients will no longer be able to connect to your Windows 2000 terminal server when the grace period ends. Additionally, you'll need to install Terminal Server Client Access Licenses (TS CALs) for any connecting workstation that has an operating system lower than Windows 2000, which includes a built-in Terminal Services client license.

These “downlevel” clients will obtain a temporary license if no TS CAL is available, but these will also expire after 90 days. So you can see how important it is to maintain and manage these license servers and licenses to ensure business continuity on networks that rely on Windows 2000 Terminal Services.

The latest enhancements and fixes from Microsoft help ensure that TS CALs are not erroneously allocated (as I explained in an earlier article), but it’s still your responsibility to ensure the that this service runs smoothly. You must make sure license servers remain available and that there are full licenses to replace temporary licenses before expiration. You also need to monitor any TS CALs you think have been allocated in error. That's where Terminal Services License Reporter (and Terminal Services License Server Viewer) can help.

Author's note
Although the Terminal Services License Reporter and the Terminal Services License Server Viewer come with the Windows 2000 Server Resource Kit and are meant to be used on Win2K Server, you can also run these tools from Windows 2000 Professional if you copy the executable (Lsreport.exe and/or Lsviewer.exe) and another file from the same folder, Mstlsapi.dll, to a folder on your Win2K Pro system.

Terminal Services License Reporter
Lsreport.exe is a great utility for both simple and complex networks. It allows you to interrogate your Windows 2000 Terminal Services Licensing database(s) and output the information to a tab-delimited text file, which you can then import to a spreadsheet or database for further analysis or graphical representation.

You can use this tool to monitor one or more license servers, and it will report back the FQDN of the license server(s), the workstation name and the user who initiated the license, when it was issued, and the type of license. The type of license is important and is probably the element you most want to monitor. For example, it shows whether a client has a temporary license, a built-in Windows 2000 license, or a Windows 2000 Terminal Services Client Access license.

The columns of information are as follows:
  • Server
  • License ID
  • Keypack ID
  • Client
  • User
  • Start
  • End
  • Issue Type
  • License Type

When running this utility, the Terminal Services Licensing service also needs to be running (otherwise, the file will be created with no entries). But you don’t need administrative privileges to use the tool.

Typically, you'll want to keep an eye on any temporary licenses so you can ensure that they will be converted to full TS CALs. This will usually mean purchasing and installing client license packs, or risking that the corresponding workstations no longer connect after their 90-day grace period. Because client licenses are taken on a first-come, first-served basis (you cannot reserve licenses for designated workstations), you may also want to ensure that TS CALs are being taken by the correct workstations.

Something else to watch out for is a workstation incorrectly taking more than one license. You may need to investigate this and contact Microsoft to reclaim licenses taken in error. The output from this utility makes the job of identifying duplicates over multiple servers easier. Once you have exported the results into a spreadsheet or database, simply sort alphabetically on the Client field and verify that each entry is unique.

Running Lsreport.exe
Fortunately, the help that accompanies Lsreport.exe is good. It lists all the command parameters you can use and provides examples of the syntax. Just run the command lsreport /? (from the folder where the executable is located) to see a list of all the parameters with two examples: running the command by itself without parameters and querying two license servers for just temporary licenses.

Running the command by itself will output the file called Lsreport.txt in the current directory, and it will query a domain controller if in Active Directory for a list of all license servers. Outside of Active Directory, it will simply use NetBIOS broadcasts to locate license servers.

Author's note
If you're using enterprise license servers rather than the default domain type, you must specify the server name(s) because they cannot be found automatically.

To query specific servers for just their temporary licenses, you use the /T parameter together with the list of servers, each separated by a space. For example, I would use this command:
lsreport /T W2KSRV448 W2KSRV500

Another useful parameter is /D for the date, which uses the format mm/dd/yyyy. With this parameter, you can extract licenses that were valid during a period you specify. (Note that "valid" isn’t the same as "issued.") If the end date isn’t specified, it defaults to today’s date. This can be useful if your license server has been running for a long period for time and you want only current information, such as a list of licenses that were valid each month.

Let’s say at the end of January, I wanted to see all the licenses that were valid by all license servers that month. I would run the following command:
lsreport /D 01/01/2003 01/31/2003

The Lsreport.txt file is overwritten by default, but this is easily remedied by using the /F parameter to specify an alternative filename and path each time. So, for example, if I wanted January’s list of valid licenses to be directed to a file called Lsreport01.txt on another server called W2KSRV002 on a share called LSREPORTS, I would issue the following command:
lsreport /F \\W2KSRV002\LSREPORTS\LSREPORT01.TXT /D 01/01/2003 01/31/2003

Summary
As you can see, the Terminal Services License Reporter offers a simple but effective way to keep a close eye on your Windows 2000 Terminal Services licensing servers and installed licenses. You can run it as needed, but since it's command-line driven, you can also incorporate it into regular maintenance batch files. Of course, it doesn’t eliminate the need to use the Terminal Services Licensing MMC and to check Event Viewer messages.

My next article will cover the corresponding GUI application, Terminal Services License Server Viewer. After that, we’ll examine the types of Terminal Services Licensing installations and take an under-the-hood look at exactly how this service works.

Editor's Picks

Free Newsletters, In your Inbox