• Home
  • BLOGS

Menu
  • Home
  • BLOGS
26 May 2020

Unlicense Office suite using last 5 characters

Written by Ryan Wilson

The following information demonstrates a manual and automated way to remove the subscription within an Office suite.

Manual process

Step 1: Open Command Prompt on PC

Open a Command Prompt window, and then take one of the following actions:

• If you installed the 64-bit version of Office 2016, move to the following folder: C:\Program Files\Microsoft Office\Office16

• If you installed the 32-bit version of Office 2016, move to the following folder: C:\Program Files (x86)\Microsoft Office\Office16

Step 2: Display the Current License(s)

Type the following command to display the license status. Note the last five characters of any and all license keys that display in the output:

cscript ospp.vbs /dstatus

Step 3: Remove the License(s)

Now run the following command as many times as needed to remove all of the license keys you noted from the previous step.

cscript ospp.vbs /unpkey:<last five characters of product key>

Step 4: Restart the Computer

Once the remove commands are successfull, close the command prompt and restart the PC.

Step 5: Reactivate MS Office 2016 with New Account

Launch one of the MS Office 2016 applications. The application should prompt you to reactivate the by providing your sign-on ID. Enter in the new user’s credentials and the software will now be licensed under their ID.

This script will gather all the Office suite subscriptions and then filter out to export only the

Automated Script

This will export all the Office licensed products to a txt file called ‘officekey’, it will then export only the office 365 suite subscription to another file called ‘officekey2’  

This key which contains the last 5 characters will then be used in the last commands to unlicense the office suite

###It will export all the Office licensed products to a txt file cqalled 'officekey', it will then export only the office 365 subscription to another file called 'officekey2'
###This key which contains the last 5 characters will then be used in the last commands to unlicense the office suite



#cd "C:\Program Files\Microsoft Office\Office16\"
#$key = (cscript OSPP.VBS /dstatus | findstr /C:"Last 5 characters of installed product key: ").replace("Last 5 characters of installed product key: ","").trim()
#$key > C:\officekey.txt
#keyout > c:\officekey2.txt

cd "C:\Program Files\Microsoft Office\Office16\"
$textfile = cscript OSPP.VBS /dstatus 
$textfile > C:\officekey.txt
sleep 15
$text = Get-Content 'C:\officekey.txt'


$output = $text -split "`n"
$row = 0
$keyrow = 0
$token = ""
$output | Foreach-Object { 
$row++;
Write-Host $_.ToString()
if ($_.ToString().Trim() -eq "LICENSE NAME: Office 16, Office16O365ProPlusR_Subscription1 edition") {
    $keyrow = $row + 7;
    
}
if ($row -eq $keyrow) {
    $token = $_.ToString().Trim().Split(":")[1].Trim();
   
}
}


Write-output $token | out-file c:\officekey2.txt

sleep 15

$keyout = Get-Content 'C:\officekey2.txt'
cscript ospp.vbs /unpkey:$keyout

Leave a Reply

Cancel reply

Recent Posts

  • MS Teams – export team owners
  • Deploy AppLocker in Intune- Block CMD and PowerShell
  • Autopilot Hybrid Joined device built outside the corporate network
  • Add a SharePoint site as a custom app within Teams
  • Query all MS Teams and Export list of guests added to each Team site
  • MS Flow – adding timestamp in the middle of a filename whilst retaining file extension
  • MS Flow to export outlook attachment into a Teams channel and notify users with an adaptive card
  • Unlicense Office suite using last 5 characters
  • Azure Information Protection – We were not able to find the Information Rights Management template.
  • Intune – Chrome homepage remediation failed Error: 0x87d1fde8

Recent Comments

  • Ged on MS Flow to export outlook attachment into a Teams channel and notify users with an adaptive card
  • film on Autopilot Hybrid Joined device built outside the corporate network
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • BurtonMBrohl on Azure Information Protection – We were not able to find the Information Rights Management template.
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • RayeXDuesing on Azure Information Protection – We were not able to find the Information Rights Management template.
  • TroyTHulette on Azure Information Protection – We were not able to find the Information Rights Management template.
  • NildaZAdamos on Azure Information Protection – We were not able to find the Information Rights Management template.
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • NoahVSolak on Azure Information Protection – We were not able to find the Information Rights Management template.

Archives

  • December 2020
  • November 2020
  • October 2020
  • August 2020
  • June 2020
  • May 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019

Categories

  • IT Blogs (19)
© Copyright 2017. Theme by BloomPixel.