windows_product_key_to_superops.ps1 - limehawk/rmm-scripts GitHub Wiki
windows_product_key_to_superops.ps1
Retrieves the Windows product key from the local machine's registry and sends it to SuperOps custom field.
Overview
Retrieves the Windows product key from the local machine's registry by decoding the DigitalProductId value and sends it to a SuperOps custom field for asset management and license tracking. Designed for unattended execution in RMM environments to automatically populate license information.
Purpose
Retrieves the Windows product key from the local machine's registry by decoding the DigitalProductId value and sends it to a SuperOps custom field for asset management and license tracking. Designed for unattended execution in RMM environments to automatically populate license information.
Prerequisites
- PowerShell 5.1 or later
- SuperOps RMM agent installed and module available
- $SuperOpsModule variable must be defined by SuperOps agent
- Registry access to read Windows product information
Configuration
Required Inputs
- CustomFieldName : 'Windows Product Key' (The name of the SuperOps custom field to populate with the product key.)
- RegistryKeyPath : 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' (Registry path where DigitalProductId is stored.)
Data Sources & Priority
- Hardcoded values (defined within the script body)
- Windows Registry (HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion)
- SuperOps API (via Send-CustomField)
- Error
Settings
- Decodes DigitalProductId using standard Windows key algorithm
- Sends decoded product key to SuperOps custom field
- Uses SuperOps module's Send-CustomField function
- Product key format: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Behavior
- Script reads DigitalProductId from registry
- Converts binary product ID to readable product key format
- Sends product key to specified SuperOps custom field
- If product key cannot be retrieved, reports error and exits
Security Notes
- Product key is sent to SuperOps (no secrets in local logs)
- Registry read is non-destructive
- Product key is considered sensitive licensing data
Exit Codes
- 0 = Success
- 1 = Failure
Example Output
[ INPUT VALIDATION ]
--------------------------------------------------------------
CustomFieldName : Windows Product Key
RegistryKeyPath : HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion
[ RETRIEVE PRODUCT KEY ]
--------------------------------------------------------------
Reading DigitalProductId from registry...
Decoding product key...
Product Key : XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
[ SEND TO SUPEROPS ]
--------------------------------------------------------------
Sending to custom field: Windows Product Key
SuperOps update successful
[ FINAL STATUS ]
--------------------------------------------------------------
Product key retrieved and sent to SuperOps successfully.
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
Version History
- 2025-10-31 v1.0.0 - Initial Style A compliant release with Windows product key retrieval and SuperOps integration.
Links
- View Script Source
- Scripts - Back to script index