It’s very common for users to switch devices or for an enterprise company to add/change Office 365 tenants. Another scenario is when enterprise organizations roam licensing/credentials to simplify sign in. After an Office 365 user activates there are four locations that must be cleared to reset the activation/install to a clean state.
1. Remove Office 365 license for Subscription based installs (not Shared Computer Licensing scenarios):
To remove the Office 365 license, you must run two cscript command lines. The command lines are:
A. Run C:\program files <x86>\Microsoft office\office15>cscript ospp.vbs /dstatus
The above command line will generate a report of the currently installed/activated license. (See Below)
B. Make note of value for “Last 5 characters of installed product key”
C. Run C:\program files <x86>\Microsoft office\office15>cscript ospp.vbs /unpkey:“Last 5 of installed product key” For example: C:\program files <x86>\Microsoft office\office15>cscript ospp.vbs /unpkey:WB222 (See Below) Repeat the step above if necessary until all keys are removed.
2. Remove cached identities in HKCU registry:
A. In the Registry Editor navigate to HKCU\Software\Microsoft\Office\15.0 or 16.0\Common\Identity\Identities and remove all of the identities under \Identities.
NOTE: If using Shared Computer Licensing remove the above Identities from HKEYUsers\SID.
3. Remove the stored Credentials in the Credential Manager:
A. Open Control Panel > Credential Manager. Remove all Windows credentials listed for Office15 or Office16.
B. To remove the Credential Click on the Drop down arrow and choose Remove from Vault.(See Below)
Shared Computer Licensing scenarios you must remove the Token and identities listed below.
File Location Appdata\local\Microsoft\Office\15.0 or 16.0\Licensing
4. Persisted locations that must be cleared
HKCU\Software\Microsoft\Protected Storage System Provider
Office 365 activation Tokens and Identity
Appdata\local\Microsoft\Office\15.0 or 16.0\Licensing
HKCU\Software\Microsoft\Office\15.0 or 16.0\Common\Identity
HKEYU\(The Users SID)\Software\Microsoft\Office\15.0 or 16.0\Common\Identity
The above steps will be reset to the activation state for Office 365(2013/2016). The activation flow after the locations are cleared will represent an initial activation scenario.
Automated Script: OLicenseCleanup.vbs