Remove Office 365 license from a Computer with PowerShell
One of my users got a notice in Office 2016 that he needed to reactivate his Office 365 subscription. After clicking reactivated a warning came up that “there was a problem with your Office 365 subscription, and we need your help to fix it“. The problem was that the registered license belonged to a user that was no longer working at our company and that license was revoked. So how can we remove the Office 365 license from this computer?
Finding out the real problem
First I wanted to know why the license was not working anymore. In Office 365 the licenses are assigned to a user. When you remove the user and revoke the license then within 90-days the installed Office 2016 will no longer work. During this grace period, you can buy / re-assign the license to the new user.
Now to check if the computer in question is licensed by this user you can log in to Office 365 and goto the My Account page: https://portal.office.com/account/. Here you see an overview of the devices on which the license is used.
Another way to check who’s license is used for the Office Installation is to open Word or Outlook and go the File > Office Account
Here you see on the right side under the Office 365 Logo Belongs To.
Remove the Office 365 license
Removing the old Office 365 license from the computer is really simple. You can use PowerShell or CMD for the steps below:
1. Open PowerShell or CMD
First, we need to open PowerShell or CMD in Administrator mode. Click on Start and type PowerShell and right click on the icon. Select Run as Administrator
2. List current licenses
If you are using PowerShell run the following command to list activated licenses:
cscript "$Env:Programfiles\Microsoft Office\Office16\OSPP.VBS" /dstatus
If you are using CMD then run the following cmd:
cscript "%Programfiles%\Microsoft Office\Office16\OSPP.VBS" /dstatus
3. Finding the expiring license
The output of the command looks like below. There could be more than one key listed, so look for a license with a REMAINING GRACE or Grace Period Expired line just above the last 5 characters of the product key.
Take a note of the 5 last characters of the product key that we need to remove.
4. Removing the product key
Run the command below to remove the license that is or is about to expire. Replace <key> with the 5 characters of the product key:
- cscript "$Env:Programfiles\Microsoft Office\Office16\OSPP.VBS" /unpkey:<key>
The command if you are using CMD:
- cscript "%Programfiles%\Microsoft Office\Office16\OSPP.VBS" /unpkey:<key>
Activating the license of the new user
If you need to activate a new license, you can just restart an Office program.
The user just needs to login to active it again.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article