- Official Post
I also created a small script to activate Office 2024 GVLK with your KMS server with a better feedback in case of an error or success.
PowerShell
# Start the stopwatch at the very beginning
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
# 1. Enforce PowerShell as Administrator
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error "Please run this PowerShell script as an Administrator!"
Exit
}
Write-Host "=== Starting Office KMS Activation ===" -ForegroundColor Cyan
# 2. Locate the Office installation directory dynamically
$OfficePath = ""
$PossiblePaths = @(
"C:\Program Files\Microsoft Office\root\Office16",
"C:\Program Files\Microsoft Office\Office16",
"C:\Program Files (x86)\Microsoft Office\root\Office16",
"C:\Program Files (x86)\Microsoft Office\Office16"
)
foreach ($Path in $PossiblePaths) {
if (Test-Path "$Path\ospp.vbs") {
$OfficePath = $Path
break
}
}
if ([string]::IsNullOrEmpty($OfficePath)) {
Write-Host "===================================================================" -ForegroundColor Red
Write-Error "ERROR: ospp.vbs was not found! Is Office actually installed?"
Write-Host "===================================================================" -ForegroundColor Red
Exit
}
Set-Location -Path $OfficePath
# 3. Inject KMS Key and Host Server
Write-Host "Configuring KMS Client Key and Host..." -ForegroundColor Yellow
$null = cscript //nologo ospp.vbs /inpkey:XJ2XN-FW8RK-P4HMP-DKDBV-GCVGB
$null = cscript //nologo ospp.vbs /sethst:your.kms.server
# 4. Trigger KMS Activation
Write-Host "Activating Office against KMS server..." -ForegroundColor Yellow
$null = cscript //nologo ospp.vbs /act
# 5. Capture and parse activation status
Write-Host "Checking activation status..." -ForegroundColor Yellow
$StatusOutput = cscript //nologo ospp.vbs /dstatus
# Initialize tracking variables
$IsLicensed = $false
$IsGrace = $false
$RemainingDays = ""
foreach ($Line in $StatusOutput) {
if ($Line -match "LICENSE STATUS:\s+---LICENSED---") {
$IsLicensed = $true
}
elseif ($Line -match "LICENSE STATUS:\s+---OOB_GRACE---|---REMAINING_GRACE---") {
$IsGrace = $true
}
elseif ($Line -match "REMAINING GRACE:\s+(\d+)\s+days") {
$RemainingDays = $Matches[1]
}
}
# Stop the stopwatch right after capturing the status
$Stopwatch.Stop()
$ElapsedTime = "{0:mm}m {0:ss}s" -f $Stopwatch.Elapsed
# 6. Big, dumb-user-friendly visual output
Write-Host ""
if ($IsLicensed) {
Write-Host "===================================================================" -ForegroundColor Green
Write-Host " SUCCESS: Office 2024 is FULLY ACTIVATED and genuine! " -ForegroundColor Green
Write-Host " Status : LICENSED (180 days standard KMS lease)" -ForegroundColor Green
Write-Host " Execution Time: $ElapsedTime" -ForegroundColor Green
Write-Host "===================================================================" -ForegroundColor Green
}
elseif ($IsGrace) {
Write-Host "===================================================================" -ForegroundColor DarkYellow
Write-Host " WARNING: Office is running in GRACE MODE! " -ForegroundColor DarkYellow
Write-Host " Status : Temporary Activation " -ForegroundColor DarkYellow
if ($RemainingDays) {
Write-Host " Remaining Time: $RemainingDays Days" -ForegroundColor DarkYellow
}
Write-Host " Execution Time: $ElapsedTime" -ForegroundColor DarkYellow
Write-Host "===================================================================" -ForegroundColor DarkYellow
}
else {
Write-Host "===================================================================" -ForegroundColor Red
Write-Host " ERROR: Office Activation FAILED! " -ForegroundColor Red
Write-Host " Execution Time: $ElapsedTime" -ForegroundColor Red
Write-Host "===================================================================" -ForegroundColor Red
$StatusOutput | Findstr /I "ERROR LICENSE"
}
Display More
Pay attention that you have to adapt the KMS server host in this file!