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 Periode 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.
You might also like:
20 thoughts on “Remove Office 365 license from a Computer with PowerShell”
THANK YOU THANK YOU THANK YOU
DUDE…. THANK YOU SO MUCH
this took so damn long. i was stuck before this article. you are doing great work.
Thank you very much, but after removing the MSOffice licence from the other pc, does the ”get genuine office” notification stop??
Well, you will need to assign a new/another license. If you have Office 365 then you can simply sign-in under File > Office Account
Worked a treat, thanks
great tutorial, thanks
i dont know how do deactivate office 2019 and to install office 365 home
really nice guide, thanks… just a heads up, if you get an error saying it could not find the script file, try the x86 folder, so just add (x86) at the end of programfiles
cscript “%Programfiles(x86)%\Microsoft Office\Office16\OSPP.VBS” /dstatus
cscript “%Programfiles(x86)%\Microsoft Office\Office16\OSPP.VBS” /unpkey:
Just to make sure I understand correctly , Removing the product key can be used to sign-out from a specific device. Without de-activating the user license, correct??
Thank you – thank you – thank you!!!
Your advice saved me from having to reformat my laptop.
I had an Office 365 installation on my laptop, license provided by my former employer. Unfortunately, it seems that they forgot to remove my laptop from their account and I had no way to ask them to do it for me. That didn’t bother me until the license expired recently,
I tried to install Office 2019 but the product indicated that it was unlicensed, showing two separate sections under “Account” tab; one for an activated Office 2019 and one unlicensed Office 365. I tried removing and reinstalling Office multiple times, even used the tools provided by Microsoft to no avail. After extensive googling, your advice did the trick!
I might kindly add that the key removal command required admin rights on my laptop, whereas both commands can also run on plain command prompt (powershell is not necessary).
Thanks for the above instructions. I have a related problem, but the above does not appear to solve my issue. I have my original personal Office 365 on my computer, which license key is noted when I run the above. However, for some reason my companies issued subscription to Office 365 Pro Plus is now also on my personal laptop, but that license does not show up when I run the above script. Even when I try to access details of my personal Office Account, it forwards me to the Pro Plus corporate account. Even when I use the Device option to sign out of my personal laptop, it does not remove the subscription key.
Any suggestions on I can remove the Pro Plus subscription key?
In my understanding, you will only see the license that is used for activating Office. I have Office 365 which is licensed by the company I work for and Office 365 personally, only the first one is displayed.
But what do you see when you look under file > Office account in one of the Office apps?
I find this solution unacceptable as an IT administrator in an enterprise with an O365 Enterprise license. No offense to you, Rudy, but is this seriously the ONLY way for administrators to deactivate terminated employees’ licenses to O365 on a workstation–individually, workstation by workstation?
As an O365 global admin, I *should* be able to deactivate any install for any user from the Admin center. Or, at the very least, with a PowerShell command. Having my IT department go around and manually deactivate licenses on workstations is just not possible.
Again, this is not a complaint of your solution but just about the the ridiculousness of Microsoft thinking this is how it should be done in an enterprise environment.
I get this when I put in both commands:
Error: Can not find script file “C:\Program Files\Microsoft Office\Office16\OSPP.VBS”. C:\Windows\system32>
Which version of Office are you using? Check your program files or program files x86 folder for Microsoft Office\Office16\OSPP.VBS and change the path in the script to the right location.
Thank you, thank you, thank you!!! I wasted almost and entire day going round and round trying to remove 365. I had installed 2019 as it is part of my MPN program and was trying to switch. Nothing worked until I tried this.
I was looking exactly for this.
Thanks a lot, it worked like a charm.
Worked perfectly removing duplicate key registration. Found and removed office 365 activation annoying popup
Hey Rudy, thanks so much for this. Home 365 user in my case, but I’ve had regular expiry/grace problems due to an expired 365 ProPlus sub which I couldn’t remove. MS couldn’t/wouldn’t help, your simple steps have fixed it.
Glad I could help 😉