:: Verificar Direitos de Administrador
@echo off
NET FILE 1>NUL 2>&1
if '%errorlevel%' == '0' ( goto Admin
) else ( start /min powershell "saps -filepath '%0' -verb runas" >nul 2>&1)
exit /b

:Admin
cls
title Ativacao do Microsoft Office Pro Plus 2019
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
for /f "tokens=2*" %%G in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (
    set "LICPATH=%%H\root\Licenses16"
)
cd /D "%SystemRoot%\System32" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProPlusVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProPlusVL_KMS_Client-ul.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProPlusVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProjectProVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProjectProVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\ProjectProVL_KMS_Client-ul.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\VisioProVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\VisioProVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\VisioProVL_KMS_Client-ul.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-bridge-office.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-root.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-root-bridge-test.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-stil.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-ul.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\client-issuance-ul-oob.xrm-ms" >nul
cscript //nologo slmgr.vbs /ilc "%LICPATH%\pkeyconfig-office.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlusVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlusVL_KMS_Client-ul.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlusVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\pkeyconfig-office.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_KMS_Client_AE-ppd.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_KMS_Client_AE-ul.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_KMS_Client_AE-ul-oob.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_MAK_AE-pl.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_MAK_AE-ppd.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_MAK_AE-ul-oob.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProPlus2019VL_MAK_AE-ul-phn.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProjectProVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProjectProVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\ProjectProVL_KMS_Client-ul.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\VisioProVL_KMS_Client-ppd.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\VisioProVL_KMS_Client-ul-oob.xrm-ms" >nul
cscript //nologo "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /inslic:"%LICPATH%\VisioProVL_KMS_Client-ul.xrm-ms" >nul

echo A Iniciar o Processo de Activacao...&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo A Activar o Microsoft Office 2019...&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=162.223.90.90
if %i%==2 set KMS_Sev=120.25.106.13
if %i%==3 set KMS_Sev=116.202.27.196
if %i%==4 set KMS_Sev=216.189.154.174
if %i%==5 goto notsupported
cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul&echo.&echo.
cscript //nologo ospp.vbs /act | find /i "successful" || (echo A Ligacao com o Servidor Falhou! A tentar ligar a outro... & echo Espere por favor... & echo. & echo. & set /a i+=1 & goto server)
goto fim

:fim
cls
echo Patch Criado por Morthis@WiNTeaM
echo.
echo Processo Concluido com Sucesso.
echo.
echo Clique em Qualquer Tecla para Fechar a Janela.
pause >nul

:notsupported
echo.&echo Ups! Algo correu mal..!!

