Category filter

Script to check OS license details on Windows devices

OS licenses are agreements that allow users to legally use and access the software. It is important for admins to ensure that these licenses comply with the terms of the organization, this includes ensuring that the correct number of licenses are being used, and that the licenses are valid and not compromised. However, manually checking the license detail on every device is tiresome. Hence, you can deploy scripts from the Hexnode portal to fetch license details on every Windows device remotely.


The sample scripts provided below are adapted from third-party open-source sites.

PowerShell script to check license details

The following script will fetch license details like License name, Description, Application ID, Product Key Channel, License URL, Validation URL, Partial Product Key, Product Key ID, License Status, and Product Key.

The following values specify the status of the license:

Value Description
0 Unlicensed
1 Licensed
2 Out-Of-Box Grace 
3 Out-Of-Tolerance Grace 
4 NonGenuineGrace 
5 Notification 
6 ExtendedGrace 

Alternatively, you can also use the following script to find the license details like the OS version, Product ID, and Product Key of devices running on a custom Windows OS.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository