How to Completely Remove Old Office License Keys Using ospp.vbs

When upgrading from an older version of Microsoft Office or transitioning away from an expired Microsoft 365 subscription, the Windows Software Protection Platform often retains obsolete cryptographic product key tokens in the background. This results in persistent “Unlicensed Product” banners and activation collisions even after entering a new, genuine product key. To completely remove old Office license keys, you must use Microsoft’s native Office Software Protection Platform script (ospp.vbs). By executing cscript ospp.vbs /dstatus in an elevated Command Prompt, you can identify the last five characters of the conflicting key and immediately uninstall it using cscript ospp.vbs /unpkey:XXXXX.
ospp.vbs directly interfaces with the local license repository to purge ghost activations.Table of Contents
1. Where is ospp.vbs Located on Windows?
The location of ospp.vbs depends on whether you have the 32-bit or 64-bit version of Office 2024, 2021, or 2019 installed:
- 64-bit Office on 64-bit Windows:
C:\Program Files\Microsoft Office\Office16 - 32-bit Office on 64-bit Windows:
C:\Program Files (x86)\Microsoft Office\Office16
2. Step 1: Query Installed Product Keys (/dstatus)
Open Command Prompt as administrator and change directory to the Office folder, then display all active license blocks:
cd “C:\Program Files\Microsoft Office\Office16”
// Display all installed licenses
cscript ospp.vbs /dstatus
Review the output. If you see multiple licenses (such as an expired Office 16, Office16ProPlusMSDNR_Retail alongside your new Office 2024 Home & Business), take note of the Last 5 characters of installed product key for the old license.
3. Step 2: Uninstall the Conflicting Key (/unpkey)
Run the uninstall command, replacing XXXXX with the 5 characters extracted from Step 1:
cscript ospp.vbs /unpkey:XXXXX
Command Prompt will confirm: <Product key uninstall successful>. If you had multiple old licenses listed in /dstatus, repeat the command for each obsolete key until only your current license remains.
4. Step 3: Clear Cached Credentials & Reactivate
Once the conflicting keys are purged, trigger immediate online activation for your legitimate license:
cscript ospp.vbs /act
For more details on resolving unlicensed warnings, read our full guide on How to Fix Microsoft Office Unlicensed Product Error.
Get a Lifetime Genuine Office Retail License
Eliminate licensing clashes forever. SortedKeys provides 100% genuine retail licenses for Microsoft Office 2024 and 2021.
View Genuine Office 2024 Keys →5. Frequently Asked Questions
What happens if I accidentally uninstall my active product key?
Don’t panic! You can reinstall your key anytime using cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX followed by cscript ospp.vbs /act.







