Get OS License Details

SOTI MobiControl
Windows

Ensuring compliance with software licensing agreements is essential for organizations to avoid legal and financial risks. The Get OS License Details script allows IT administrators to remotely retrieve licensing information from Windows devices enrolled in SOTI MobiControl. This includes verifying the number of licenses in use, ensuring their validity, and confirming that they are not compromised. By automating this process, administrators can easily monitor and manage OS licenses across their fleet of devices, saving time and ensuring compliance without the need for manual checks on each individual device.

Important:
  • It is recommended to test the script on a local/ test machine for its purpose and effects. 
  • SOTI MobiControl will not be responsible for any damage/loss to the data/setup based on the behavior of the script.

Fetch OS license details

1 # Get OS License Details
2 $licenseInfo = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL"
3 if ($licenseInfo) {
4 foreach ($license in $licenseInfo) {
5 Write-Output "----------------------------------------"
6 Write-Output "License Name: $($license.Name)"
7 Write-Output "License Status: $($license.LicenseStatus)"
8 Write-Output "Product Key (Last 5 Digits): $($license.PartialProductKey)"
9 Write-Output "License URL: $($license.LicenseURL)"
10 Write-Output "Validation URL: $($license.ValidationURL)"
11 Write-Output "Description: $($license.Description)"
12 Write-Output "Application ID: $($license.ApplicationID)"
13 Write-Output "Product Key Channel: $($license.ProductKeyChannel)"
14 Write-Output "License Family: $($license.LicenseFamily)"
15 }
16 } else {
17 Write-Output "No license information found."
18 }
19 # Get Additional Activation Details
20 $activationInfo = Get-CimInstance SoftwareLicensingService
21 Write-Output "----------------------------------------"
22 Write-Output "Original Product Key: $($activationInfo.OA3xOriginalProductKey)"
23 Write-Output "Remaining Windows Grace Period (Days): $($activationInfo.RemainingGracePeriod)"
24 Write-Output "----------------------------------------"

Was this helpful?

Need more help?
Ask Community