https://gist.github.com/mndambuki/bf3b6a1de33dd84dc4f59dcf8e111618
From the above link you will get below codes .bat version.
1. Now save the below green commands in a file i.e. activation.ps1
Write-Host "Activating Microsoft Office 2019..."
# Office installation path detection
if (Test-Path "C:\Program Files\Microsoft Office\root\Office16\ospp.vbs") {
cd "C:\Program Files\Microsoft Office\root\Office16"
} elseif (Test-Path "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs") {
cd "C:\Program Files (x86)\Microsoft Office\Office16"
} else {
Write-Host "Office installation not found."
exit
}
# Remove previous KMS configuration
cmd.exe /c "cscript //nologo slmgr.vbs /ckms"
cmd.exe /c "cscript //nologo ospp.vbs /setprt:1688"
cmd.exe /c "cscript //nologo ospp.vbs /unpkey:6MWKP"
# Enter new product key
cmd.exe /c "cscript //nologo ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP"
# Set KMS server and attempt activation
$kmsServers = @("kms.03k.org", "kms8.msguides.com", "kms.digiboy.ir")
foreach ($server in $kmsServers) {
cmd.exe /c "cscript //nologo ospp.vbs /sethst:$server"
Start-Sleep -Seconds 3
$activationResult = cmd.exe /c "cscript //nologo ospp.vbs /act"
if ($activationResult -match "successful") {
Write-Host "Office activation successful!"
break
} else {
Write-Host "Failed to connect to $server. Trying next..."
}
}
Write-Host "Activation process complete."
2. Now open powershell ISE with admin privilege and go to the location where you saved this powershell script
3. Now run this following red mark command in the powershell ISE console.
First go to the location where the script is present.
Powershell.exe -ExecutionPolicy Bypass -File .\activation.ps1
4. Now remove the wrong kms server. From the same ISE engine shell, run below commands. Please follow the above same process.
if (Test-Path "$Env:ProgramFiles\Microsoft Office\root\Office16\ospp.vbs") {
Set-Location "$Env:ProgramFiles\Microsoft Office\root\Office16"
} elseif (Test-Path "$Env:ProgramFiles(x86)\Microsoft Office\Office16\ospp.vbs") {
Set-Location "$Env:ProgramFiles(x86)\Microsoft Office\Office16"
} else {
Write-Host "Office 2019 not found." -ForegroundColor Red
exit
}
Start-Process -FilePath "cscript.exe" -ArgumentList "ospp.vbs /remhst" -NoNewWindow -Wait
Write-Host "KMS server has been removed from Office configuration." -ForegroundColor Green
5. Now reboot your system.
This is another from the above first link. I just modified something.
@echo off
title Activate Microsoft Office 2019 !
cls
echo ============================================================================
echo #Project: Activating Microsoft software products
echo ============================================================================
echo.
echo #Supported products:
echo - Microsoft Office Standard 2019
echo - Microsoft Office Professional Plus 2019
echo.
echo.
(if exist "%ProgramFiles%\Microsoft Office\root\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\root\Office16")
(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")
(for /f %%x in ('dir /b ..\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\Licenses16\%%x" >nul)
(for /f %%x in ('dir /b ..\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\Licenses16\%%x" >nul)
echo.
echo ============================================================================
echo Activating your Office...
cscript //nologo slmgr.vbs /ckms >nul
cscript //nologo ospp.vbs /setprt:1688 >nul
cscript //nologo ospp.vbs /unpkey:6MWKP >nul
cscript //nologo ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP >nul
set i=1
:server
if %i%==1 set KMS_Sev=kms.03k.org
if %i%==2 set KMS_Sev=kms.03k.org
if %i%==3 set KMS_Sev=kms.03k.org
if %i%==4 goto notsupported
cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul
echo ============================================================================
echo.
echo.
cscript //nologo ospp.vbs /act | find /i "successful"
(echo.
echo ============================================================================
echo #Please feel free to contact me at ***@gmail.com if you have any questions or concerns.
echo ============================================================================
choice /n /c YN /m "Would you like to visit my Page [Y,N]?"
if errorlevel 2 exit) || (echo The connection to my KMS server failed! Trying to connect to another one...
echo Please wait...
echo.
echo.
set /a i+=1
goto server)
explorer "http://github.io/agileehsan"
goto halt
:notsupported
echo.
echo ============================================================================
echo Sorry! Your version is not supported.
echo.
:halt
pause >nul
Avi
Comments
Post a Comment