Created
May 19, 2016 19:10
-
-
Save Hexalon/508442e4423a1471b861b93f263db923 to your computer and use it in GitHub Desktop.
Set the KMS host for Office and activates Office.
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
[CmdletBinding()] | |
Param () | |
<# | |
.NOTES | |
=========================================================================== | |
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.120 | |
Created on: 4/27/2016 14:56 | |
Created by: Colin Squier <[email protected]> | |
Filename: Fix-OfficeActivation.ps1 | |
=========================================================================== | |
.DESCRIPTION | |
Set the KMS host for Office and activates Office. | |
#> | |
$Office14 = "$ENV:ProgramFiles\Microsoft Office\Office14\OSPP.vbs" | |
if (Test-Path -Path $Office14) | |
{ | |
Write-Verbose -Message "Office 2010 64-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office14`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office14`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} | |
$Office14 = "${ENV:ProgramFiles(x86)}\Microsoft Office\Office14\OSPP.vbs" | |
if (Test-Path -Path $Office14) | |
{ | |
Write-Verbose -Message "Office 2010 32-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office14`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office14`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} | |
$Office15 = "$ENV:ProgramFiles\Microsoft Office\Office15\OSPP.vbs" | |
if (Test-Path -Path $Office15) | |
{ | |
Write-Verbose -Message "Office 2013 64-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office15`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office15`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} | |
$Office15 = "${ENV:ProgramFiles(x86)}\Microsoft Office\Office15\OSPP.vbs" | |
if (Test-Path -Path $Office15) | |
{ | |
Write-Verbose -Message "Office 2013 32-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office15`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office15`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} | |
$Office16 = "$ENV:ProgramFiles\Microsoft Office\Office16\OSPP.vbs" | |
if (Test-Path -Path $Office16) | |
{ | |
Write-Verbose -Message "Office 2016 64-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office16`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office16`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} | |
$Office16 = "${ENV:ProgramFiles(x86)}\Microsoft Office\Office16\OSPP.vbs" | |
if (Test-Path -Path $Office16) | |
{ | |
Write-Verbose -Message "Office 2016 32-Bit" | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office16`" /sethst:kms.example.com" -Wait -NoNewWindow -ErrorAction Stop | |
Start-Process -FilePath "cscript.exe" -ArgumentList "`"$Office16`" /act" -Wait -NoNewWindow -ErrorAction Stop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment