Last active
April 13, 2017 07:53
-
-
Save gioxx/2db88e72dd466a15fe4a to your computer and use it in GitHub Desktop.
Effettua il reset della licenza di un Office 2013 Pro Plus basato su attivazione Office 365, la Powershell deve poter eseguire script non firmati (Set-ExecutionPolicy Unrestricted)(Credits: johndoe26 Jan 5, 2015 at 9:40pm http://community.spiceworks.com/how_to/48973-remove-and-re-add-license-key-for-office-2013-on-office-365)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# store the license info into an array | |
$license = cscript ‘C:\Program Files\Microsoft Office\Office15\OSPP.VBS’ /dstatus | |
#license name from /dstatus | |
$o365 = “OfficeO365ProPlusR_Subscription1 edition” | |
#loop till the end of the array searching for the $o365 string | |
for ($i=0; $i -lt $license.Length; $i++){ | |
if ($license[$i] -match $o365){ | |
$i += 6 #jumping six lines to get to the product key line in the array, check output of dstatus and adjust as needed for the product you are removing | |
$keyline = $license[$i] # extra step but i would rather deal with the variable as a string than an array, could be removed i guess, efficiency is not my concern | |
$prodkey = $keyline.substring($keyline.length – 5, 5) # getting the last 5 characters of the line (prodkey) | |
} | |
} | |
#removing the key from the workstation | |
cscript ‘C:\Program Files\Microsoft Office\Office15\OSPP.VBS’ /unpkey:$prodkey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment