Created
November 11, 2019 14:56
-
-
Save kevinblumenfeld/4d625f25122c074c02f373729dc2320f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$licrem = join-path $env:temp OfficeProPlusLicenseRemoved.txt | |
if (-not (Test-Path $licrem)) { | |
$license = cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus | |
$o365 = 'LICENSE NAME' | |
for ($i = 0; $i -lt $license.Length; $i++) { | |
if ($license[$i] -match $o365) { | |
$i += 6 | |
$keyline = $license[$i] | |
$prodkey = $keyline.substring($keyline.length - 5, 5) | |
} | |
} | |
cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /unpkey:$prodkey | |
New-Item $licrem | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment