Disaster strikes !
You company has lost an employee and his or her computer gets transferred to a new colleague, who’s freshly hired.
When your lazy-mode kicks in as an IT implementor, you’re probably gonna go and rename the old account in the Office 365 portal and go on with ordinary life as a sysadmin.
However, this will bring some new issues to the table.
- The user will still be named as the old user in the internal database of O365
- Here and there, references to the old name will still appear in the web portal, as well as in the ‘edited by’ properties of Office documents.
- Your physical install of Office will still refer to the old user and will ask for reactivation, which will not work.
- … (which is short for “I can’t think of anything else, but I’m sure there is more”)
Having been told I should be less agressive, I’ll try to go towards a passive agressive mode and say “this is what I suggest you should do” instead of “now do this”.
The general idea here is to convert the old mailbox (if there is any, this depends on the O365 subscription) to a shared mailbox, wait for the actual conversion to be done (this is an incredibly important part which is overlooked often) and then take away the e-mail-holding license (Plan 1, Business Premium, E3, E5, …) from that user.
The detailed explanation on how to do that, is not relevant to this post, right now.
Afterwards, create the new user and add the license.
What IS relevant, is the removal of the old license on the computer that remains behind and is passed on to the new user.
A couple of steps need to be taken in order to clean up the installation, so it can be re-linked to a new O365 user.
- Use the Office Software Protection Platform script to remove the license from the computer.
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)
NOTE: You might see multiple licenses in the /dstatus report.
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.
After running the /unpkey: command line you will see a “Product Key uninstall successful” message. You can now close the Command Prompt and move onto Step 2.
- Remove cached identities in the registry.
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.
- Remove stored credentials in 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)
In Shared Computer Licensing scenarios you must remove the Token and identities listed below.
%userprofile%\Appdata\local\Microsoft\Office\15.0 or 16.0\Licensing
- Manually cleanup specific folders.
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.
TL;DR ? Download OLicenseCleanup.vbs_1 , rename to a .VBS file (by removing the .TXT extension, why am I even saying this. Really? If you don’t know how file extensions work in Windows, please stop reading now and educate yourself on this subject)
Partly taken from Technet