29 lines
887 B
PowerShell
29 lines
887 B
PowerShell
##### Fix locally, run as admin
|
|
Set-Location "C:\Program Files\Microsoft Office\Office16\" # might be a different folder for different versions
|
|
|
|
# get current status
|
|
cscript .\ospp.vbs /dstatus
|
|
|
|
# set KMS server and activate
|
|
cscript .\ospp.vbs /sethst:kms.nd.gov
|
|
cscript .\ospp.vbs /act
|
|
|
|
|
|
|
|
##### Fix remotely, will prompt for PRV credentials
|
|
$Credential = Get-Credential -Message "Enter your PRV credentials"
|
|
|
|
# Get current status
|
|
Invoke-Command -Credential $Credential -ComputerName server01,server02,server03 -ScriptBlock {
|
|
Set-Location "C:\Program Files\Microsoft Office\Office16\"
|
|
cscript .\ospp.vbs /dstatus
|
|
}
|
|
|
|
|
|
# Set KMS server and activate
|
|
Invoke-Command -Credential $Credential -ComputerName server01,server02,server03 -ScriptBlock {
|
|
Set-Location "C:\Program Files\Microsoft Office\Office16\"
|
|
cscript .\ospp.vbs /sethst:kms.nd.gov
|
|
cscript .\ospp.vbs /act
|
|
}
|