PowerShell script to expire a license

ExpireLicense [-ProductID <integer> [-FeatureString <string>] [-UseHKLM] ]

This PowerShell script changes the activation status of a specified product license (and feature string if applicable) to Expired. If run with no arguments, the script will display products containing a status along with their corresponding product IDs for easy reference. Specify a product ID to expire. Note that the ID specified need not be in the list. If the product ID specified contains feature strings, the script will display a list of feature strings and ask which one to expire.

For support of server products, the script will offer to edit statuses in the All Users profile if any are detected there. Note that when editing the All Users profile, the script should be explicitly executed as an administrator.

For automation, the script can be executed with a ProductID and an optional FeatureString parameter to expire (if applicable). While product IDs can be specified regardless of whether they exist in the activation statuses already, feature strings must be present first. The script cannot create new feature string entries. The UseHKLM flag also can optionally be specified to edit the All Users profile if entries are detected there.

Last modified: September 7, 2017
Version: 1.0.0

Important: Change the extension of the script from TXT to PS1 before executing. For security reasons, PowerShell script execution may be disabled by default. To temporarily allow the execution of scripts, run the following command from a Command Prompt, and execute the PowerShell script from this window:
PowerShell.exe -ExecutionPolicy bypass

Related
Recommended