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.
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, and License Status.
1 2 3 4 5 6 7 8 9 10 |
$lic = Get-WmiObject -Class SoftwareLicensingProduct | Where-Object {$_.PartialProductKey -ne $null} echo "License Name: $($lic.Name)" echo "Descriptions: $($lic.Description)" echo "Application ID: $($lic.ApplicationId)" echo "Product Key Channel: $($lic.ProductKeyChannel)" echo "Use License URL: $($lic.UseLicenseURL)" echo "Validation URL: $($lic.ValidationURL)" echo "PartialProductKey: $($lic.PartialProductKey)" echo "ProductKey ID: $($lic.ProductKeyID)" echo "License Status: $($lic.LicenseStatus)" |
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 |