Solution
NI License Manager and VLM do not have API that query license information or status. To programmatically obtain license information, the following options can be considered.
Querying License Status From NI License Manager
To check if a software component is licensed locally:
- Use LabVIEW Error Handling to determine if an installed software component is activated.
- For example, manual error handling can be used to identify which specific errors are thrown when using an unlicensed NI software component. If a VI is using an unlicensed toolkit or module, calling the VI dynamically will throw an error if it is unlicensed.
- Develop code that parses the local license files in C:\ProgramData\National Instruments\License Manager\Licenses to identify if a specific NI software component is already activated.
- For example, the code may check if the license file related to a specific software component is present on the PC. Then, the code can parse the file to check if the expiration date occurs in the future.
- The image below is an example of a local license file for LabVIEW, which expires on July 11th 2025.
Querying Seat Usage From NI VLM
To programmatically check the usage of a network license, develop code that parses the lmgrd.log file in C:\ProgramData\National Instruments\License Manager\Data on the license server PC. This file is a log of all license usage and contains information about when a license is consumed by a client and when it is returned to the server.
The image below shows an example of the lmgrd.log contents. It consists of entries formatted as <Timestamp> (nilim) <OUT or IN>: "<Product Name>" <related client PC>. For example:
14:14:30 (nilm) OUT: "LabVIEW_Pro" ClientSystemA
15:14:30 (nilm) IN: "LabVIEW_Pro" ClientSystemA
15:15:00 (nilm) OUT: "LabVIEW_Pro" ClientSystemB