Advertisement
Specowy

Untitled

Nov 24th, 2019
2,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 58.18 KB | None | 0 0
  1. @echo off
  2. set /a _Debug=0
  3. ::==========================================
  4. :: Get Administrator Rights
  5. set _Args=%*
  6. if "%~1" NEQ "" (
  7.   set _Args=%_Args:"=%
  8. )
  9. fltmc 1>nul 2>nul || (
  10.   cd /d "%~dp0"
  11.   cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~dp0"" && ""%~dpnx0"" ""%_Args%""", "", "runas", 1 > "%temp%\GetAdmin.vbs"
  12.   "%temp%\GetAdmin.vbs"
  13.   del /f /q "%temp%\GetAdmin.vbs" 1>nul 2>nul
  14.   exit
  15. )
  16. ::==========================================
  17. :: Can be 0 (Delete Auto-Renewal-Task OR Manual-Mode) | 1 (Create Auto-Renewal-Task)
  18. set /a _Task=1
  19. :: Define switches
  20. echo %*| find /i "-createtask" >nul&& set /a _Task=1
  21. echo %*| find /i "-renewalonly" >nul&& set /a _Task=2
  22. ::==========================================
  23. :: No Debug, Define the nul suppressors
  24. if %_Debug% EQU 0 (
  25.   set "_Nul_1=1>nul"
  26.   set "_Nul_2=2>nul"
  27.   set "_Nul_2e=2^>nul"
  28.   set "_Nul_1_2=1>nul 2>nul"
  29.   call :Begin
  30. ) else (
  31.   REM Debug, Clear all nul suppressors, Call script redirecting output to log file
  32.   set "_Nul_1="
  33.   set "_Nul_2="
  34.   set "_Nul_2e="
  35.   set "_Nul_1_2="
  36.   echo.
  37.   echo Running in Debug Mode...
  38.   echo The window will be closed when finished
  39.   @echo on
  40.   @prompt $G
  41.   @call :Begin >"%~dpn0.tmp" 2>&1 &cmd /u /c type "%~dpn0.tmp">"%~dpn0_Debug.log"&del "%~dpn0.tmp"
  42. )
  43. exit
  44. ::==========================================
  45. :Begin
  46. :: Set Title of the Script; Color [Background][Text] in hex (0 to F)
  47. title O19 Activation Outil
  48. color 07
  49. :: Get Fully Qualified FileName of the Script
  50. set "_FileName=%~f0"
  51. :: Get Drive and Path containing the Script
  52. set "_FileDir=%~dp0"
  53. if "%_FileDir:~-1%"=="\" set "_FileDir=%_FileDir:~0,-1%"
  54. :: Set Internal KMS Server Path
  55. set "_ServerPath=%_FileDir%\32-bit\vlmcsd.exe"
  56. :: Set Task Name for the Script
  57. set "_TaskName=Office 2019 Statique Activation Planificateur"
  58. :: Set EnableExtensions and DelayedExpansion
  59. setlocal EnableExtensions EnableDelayedExpansion
  60. :: Can be 0 (Online Mode - Used for External KMS Server) | 1 (Offline Mode - Used for Internal KMS Server)
  61. set /a _OfflineMode=1
  62. :: Can be ONSTART | ONLOGON | MINUTE(1-1439) | HOURLY(1-23) | DAILY(1-365) | WEEKLY(1-52) | MONTHLY(1-12)
  63. set "_TaskFrequency=ONLOGON"
  64. :: Can be integers in the range shown above
  65. set /a _TaskModifier=1
  66. ::==========================================
  67. :: Set Parameters for KMS Server
  68. :: Custom Windows ePID
  69. set "_WindowsEPID=03612-00206-471-452343-03-1033-14393.0000-1082018"
  70. :: Custom Windows 10 Enterprise G/GN ePID
  71. set "_WindowsGEPID=03612-00206-471-452343-03-1033-14393.0000-1082018"
  72. :: Custom Office 2010 ePID
  73. set "_Office2010EPID=03612-00096-199-303490-03-1033-14393.0000-1082018"
  74. :: Custom Office 2013 ePID
  75. set "_Office2013EPID=03612-00206-234-394838-03-1033-14393.0000-1082018"
  76. :: Custom Office 2016 ePID
  77. set "_Office2016EPID=03612-00206-437-938923-03-1033-14393.0000-1082018"
  78. :: Can be Custom HardwareID obtained from a Real KMS Server Host
  79. set "_HardwareID=3A1C049600B60076"
  80. :: Can be 0 (Custom ePIDs) | 1 (Randomized ePIDs for every Session) | 2 (Randomized ePIDs for every Request)
  81. set /a _RandomLevel=0
  82. :: Can be (15 to 43200) minutes; Default - 2 hours, Maximum - 30 days
  83. set /a _KMSActivationInterval=43200
  84. :: Can be (15 to 43200) minutes; Default - 7 days, Maximum - 30 days
  85. set /a _KMSRenewalInterval=43200
  86. ::==========================================
  87. :: Set Parameters for KMS Client
  88. :: _KMSHost Can be (0-255.0-255.0-255.0-255), but NOT 127.x.x.x/Localhost IPs [Offline Mode] | KMS-ServerName/IP [Online Mode]
  89. set "_KMSHost=172.16.0.4"
  90. set "_KMSLocalHost=127.0.0.2"
  91. :: Can be (1 to 65535) [Offline Mode]; 1688 [Online Mode]
  92. set /a _KMSPort=1686
  93. ::==========================================
  94. :: Set Registry Key for DLL Hook
  95. set "_regKey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"
  96. ::==========================================
  97. :: Registry Keys for SPP and OSPP
  98. set "_hkSPP=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
  99. set "_huSPP=HKEY_USERS\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
  100. set "_hkOSPP=HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
  101. ::==========================================
  102. :: Set KMS Genuine Ticket Validation Parameters
  103. :: Can be 0 (Enable Genuine Ticket) | 1 (Disable Genuine Ticket)
  104. set /a _KMSNoGenTicket=1
  105. :: Registry Key for KMS Genuine Ticket
  106. set "_KMSGenuineKey=HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform"
  107. ::==========================================
  108. :: Go to the Path of the Script
  109. pushd "%_FileDir%"
  110.  
  111. :: Check if [Office 2010 on Windows XP SP3 or Later] OR [Office 2013 or Later on Windows 7 / Server 2008 R2] is Installed
  112. wmic path OfficeSoftwareProtectionService get Version %_Nul_1_2% && (
  113.   set /a _OSPS=1
  114. ) || (
  115.   set /a _OSPS=0
  116. )
  117.  
  118. :: Check if Office products are ACTUALLY installed
  119. for %%G in (14,15,16) do (
  120.   call :OfficeDetect %%G
  121. )
  122.  
  123. :: Get Architecture of the OS installed; OS Locale Independent from Windows XP / Server 2003 and Later
  124. for /f "tokens=2 delims==" %%G in ('wmic path Win32_Processor get AddressWidth /value') do (
  125.   set "_OSarch=%%G-bit"
  126. )
  127.  
  128. :: Visual Studio Activation
  129. call :VisualStudio "12.0" "InstallDir" "" "87DQC-G8CYR-CRPJ4-QX9K8-RFV2B" "06181" "2013 Ultimate"
  130. call :VisualStudio "14.0" "InstallDir" "" "HM6NR-QXX7C-DFW2Y-8B82K-WTYJV" "07060" "2015 Enterprise"
  131. call :VisualStudio "SxS\VS7" "15.0" "Common7\IDE" "NJVYC-BMHX2-G77MM-4XJMR-6Q8QF" "08860" "2017 Enterprise"
  132.  
  133. :: Get Windows OS build number
  134. for /f "tokens=2 delims==" %%G in ('wmic path Win32_OperatingSystem get BuildNumber /value') do (
  135.   set /a _WinBuild=%%G
  136. )
  137.  
  138. :: Define installed Edition for Windows 10 build 1607 or later
  139. if %_WinBuild% LSS 14393 goto :Main
  140. :: Get Edition based on active CBS package, or fall back to Dism CurrentEdition
  141. set "_CBS=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages"
  142. set "_Pattern=Microsoft-Windows-*Edition~31bf3856ad364e35"
  143. set "_EditionPkg=NUL"
  144. for /f "tokens=8 delims=\" %%G in ('reg query "%_CBS%" /f "%_Pattern%" /k %_Nul_2e% ^| find /i "CurrentVersion"') do (
  145.   reg query "%_CBS%\%%G" /v "CurrentState" %_Nul_2% | find /i "0x70" %_Nul_1% && (
  146.     for /f "tokens=3 delims=-~" %%H in ('echo %%G') do set "_EditionPkg=%%H"
  147.   )
  148. )
  149. if /i "%_EditionPkg:~-7%"=="Edition" (
  150.   set "_Edition=%_EditionPkg:~0,-7%"
  151. ) else (
  152.   for /f "tokens=3 delims=: " %%G in ('dism /English /Online /Get-CurrentEdition %_Nul_2e% ^| find /i "Current Edition :"') do (
  153.     set "_Edition=%%G"
  154.   )
  155. )
  156. :: Get Edition based on current installed product key
  157. for /f "tokens=2 delims==" %%G in ('"wmic path SoftwareLicensingProduct where (Name like 'Windows%%' and PartialProductKey is not NULL) get LicenseFamily /value"') do if not errorlevel 1 (
  158.   set "_EditionWMI=%%G"
  159. )
  160. if not defined _EditionWMI (
  161.   if %_WinBuild% GEQ 17063 (
  162.     for /f "skip=2 tokens=3" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionId') do (
  163.       set "_Edition=%%G"
  164.     )
  165.   )
  166.   goto :Main
  167. )
  168. :: Exclude Windows 10 S
  169. for %%G in (Cloud,CloudN) do (
  170.   if /i "%_EditionWMI%"=="%%G" goto :Main
  171. )
  172. set "_Edition=%_EditionWMI%"
  173. ::==========================================
  174. :Main
  175. :: Goto Main blocks according to Windows BuildNumber
  176. if %_WinBuild% GEQ 9600 (
  177.   REM NO parenthesis or brackets in echo messages
  178.   echo Operating System: Windows 8.1 or Later
  179.   goto :Win8.1AndLater
  180. ) else if %_WinBuild% GEQ 2600 (
  181.   echo Operating System: Windows 8 or Earlier
  182.   goto :Win8AndEarlier
  183. ) else (
  184.   echo KMS_VL_ALL is NOT supported on this OS.
  185.   echo.
  186.   echo Closing in 5 Seconds...
  187.   ping 127.0.0.1 -n 6 %_Nul_1_2%
  188.   exit /b
  189. )
  190. ::==========================================
  191. :Close
  192. :: Create/Delete Auto-Renewal Task based on parameter; Windows XP SP3 or Later Compatible
  193. if %_Task% EQU 1 (
  194.   schtasks /query /fo list %_Nul_2% | findstr /i "%_TaskName%" %_Nul_1% && (
  195.     schtasks /delete /tn "%_TaskName%" /f %_Nul_1_2%
  196.   )
  197.   if /i %_TaskFrequency% EQU ONSTART (
  198.     schtasks /create /tn "%_TaskName%" /ru "SYSTEM" /sc "%_TaskFrequency%" /tr "%_FileName% -renewalonly" %_Nul_1_2% && (
  199.       echo.
  200.       echo Auto-Renewal Task is Created.
  201.     )
  202.   ) else if /i %_TaskFrequency% EQU ONLOGON (
  203.     schtasks /create /tn "%_TaskName%" /ru "SYSTEM" /sc "%_TaskFrequency%" /tr "%_FileName% -renewalonly" %_Nul_1_2% && (
  204.       echo.
  205.       echo Auto-Renewal Task is Created.
  206.     )
  207.   ) else (
  208.     schtasks /create /tn "%_TaskName%" /ru "SYSTEM" /sc "%_TaskFrequency%" /mo "%_TaskModifier%" /tr "%_FileName% -renewalonly" %_Nul_1_2% && (
  209.       echo.
  210.       echo Auto-Renewal Task is Created.
  211.     )
  212.   )
  213. ) else if %_Task% EQU 0 (
  214.   schtasks /query /fo list %_Nul_2% | findstr /i "%_TaskName%" %_Nul_1% && (
  215.     schtasks /delete /tn "%_TaskName%" /f %_Nul_1_2%
  216.     echo.
  217.     echo Auto-Renewal Task is Deleted.
  218.   )
  219. )
  220. if %_Debug% EQU 0 (
  221.   echo.
  222.   echo Closing in 5 Seconds...
  223.   ping 127.0.0.1 -n 6 %_Nul_1_2%
  224. )
  225. exit /b
  226. ::==========================================
  227. :Win8.1AndLater
  228. if %_OfflineMode% EQU 1 (
  229.   REM Stop 'sppsvc'
  230.   call :StopService "sppsvc"
  231.   REM Symlink the DLL Injection file to system32 folder based on OS architecture
  232.   mklink "%SystemRoot%\system32\SECOPatcher.dll" "%_FileDir%\%_OSarch%\SECOPatcher.dll" %_Nul_1_2%
  233.   REM Check Read/Execute security permissions and grant them if necessary
  234.   icacls "%SystemRoot%\system32\SECOPatcher.dll" /findsid *S-1-5-32-545 %_Nul_2% | find /i "SECOPatcher.dll" %_Nul_1% || (
  235.     icacls "%SystemRoot%\system32\SECOPatcher.dll" /grant *S-1-5-32-545:RX %_Nul_1_2%
  236.   )
  237.   REM Create registry keys for DLL Patcher
  238.   call :CreateIFEOEntry "SppExtComObj.exe"
  239.   REM Add Firewall Exceptions for VLMCSD and Start KMS Server
  240.   call :AddFirewallRule
  241.   call :StartKMS
  242. )
  243.  
  244. :: Enable/Disable KMS Genuine Ticket Validation for Windows 8.1 and later
  245. if %_WinBuild% GEQ 9600 (
  246.   call :KMSGenuineTicket
  247. )
  248.  
  249. :: Call Windows and Office Activation Main Functions
  250. call :SLSActivation
  251. if %_OSPS% NEQ 0 (
  252.   if %_OfflineMode% EQU 1 (
  253.     REM Localhost IP should be used for Office 2010 on Windows 8.1 and later
  254.     set "_KMSHost=%_KMSLocalHost%"
  255.   )
  256.   call :OSPSActivation
  257. )
  258. if %_OfflineMode% EQU 1 (
  259.   REM Stop 'sppsvc'
  260.   call :StopService "sppsvc"
  261.   REM Stop KMS Server and Remove Firewall Exceptions for VLMCSD
  262.   call :StopKMS
  263.   call :RemoveFirewallRule
  264.   REM Restore original security permissions if changed
  265.   icacls "%SystemRoot%\system32\SECOPatcher.dll" /reset %_Nul_1_2%
  266.   REM Delete the DLL Injection symlink from system32 folder
  267.   if exist "%SystemRoot%\system32\SECOPatcher.dll" del /f /q "%SystemRoot%\system32\SECOPatcher.dll" %_Nul_1_2%
  268.   REM Remove registry keys for DLL Hook
  269.   call :RemoveIFEOEntry "SppExtComObj.exe"
  270.   REM Start 'sppsvc'
  271.   sc start sppsvc trigger=timer;sessionid=0 %_Nul_1_2%
  272. )
  273. call :Close & exit /b
  274. ::==========================================
  275. :Win8AndEarlier
  276. :: Exit if No Office 2010 product is installed on Windows XP SP3/Server 2003 R2
  277. if %_OSPS% EQU 0 (
  278.   if %_WinBuild% LSS 6000 (
  279.     echo.
  280.     echo No Office 2010 Product Detected...
  281.     call :Close & exit /b
  282.   )
  283. )
  284.  
  285. if %_OfflineMode% EQU 1 (
  286.   REM Localhost IP can be used for Windows 8 and earlier
  287.   set "_KMSHost=%_KMSLocalHost%"
  288.   REM Windows Vista do not support SetKeyManagementServicePort, so revert to default KMS port
  289.   if %_WinBuild% LSS 7600 (
  290.     set /a _KMSPort=1688
  291.   )
  292.   REM Add Firewall Exceptions for VLMCSD and Start KMS Server
  293.   call :AddFirewallRule
  294.   call :StartKMS
  295. )
  296.  
  297. :: Call Windows and Office Activation Main Functions
  298. if %_WinBuild% GEQ 6000 (
  299.   call :SLSActivation
  300. )
  301. if %_OSPS% NEQ 0 (
  302.   call :OSPSActivation
  303. )
  304.  
  305. if %_OfflineMode% EQU 1 (
  306.   REM Stop KMS Server and Remove Firewall Exceptions for VLMCSD
  307.   call :StopKMS
  308.   call :RemoveFirewallRule
  309. )
  310. call :Close & exit /b
  311. ::==========================================
  312. :AddFirewallRule
  313. :: Add VLMCSD KMS Exception to Windows Firewall
  314. if %_WinBuild% LSS 6000 (
  315.   netsh firewall delete allowedprogram "%_ServerPath%" %_Nul_1_2%
  316.   netsh firewall add allowedprogram "%_ServerPath%" "vlmcsd" %_Nul_1_2%
  317. ) else (
  318.   netsh advfirewall firewall delete rule name="vlmcsd" %_Nul_1_2%
  319.   netsh advfirewall firewall add rule name="vlmcsd" dir=in action=allow profile=any program="%_ServerPath%" %_Nul_1_2%
  320. )
  321. exit /b
  322. ::==========================================
  323. :RemoveFirewallRule
  324. :: Remove VLMCSD KMS Exception from Windows Firewall
  325. if %_WinBuild% LSS 6000 (
  326.   netsh firewall delete allowedprogram "%_ServerPath%" %_Nul_1_2%
  327. ) else (
  328.   netsh advfirewall firewall delete rule name="vlmcsd" %_Nul_1_2%
  329. )
  330. exit /b
  331. ::==========================================
  332. :StartKMS
  333. :: Start VLMCSD KMS Server
  334. if %_RandomLevel% EQU 0 (
  335.   cmd /c start /b "" "%_ServerPath%" -P %_KMSPort% -0 %_Office2010EPID% -3 %_Office2013EPID% -6 %_Office2016EPID% -w %_WindowsEPID% -G %_WindowsGEPID% -H %_HardwareID% -R %_KMSRenewalInterval% -A %_KMSActivationInterval% -T0 -e %_Nul_1_2%
  336. ) else (
  337.   cmd /c start /b "" "%_ServerPath%" -r %_RandomLevel% -P %_KMSPort% -H %_HardwareID% -R %_KMSRenewalInterval% -A %_KMSActivationInterval% -T0 -e %_Nul_1_2%
  338. )
  339. :: Mind boggling BUG Fix; Windows Vista or earlier takes some time to start KMS Server which prevents Activation; So add delay for it to successfully start
  340. if %_WinBuild% LSS 7600 (
  341.   ping 127.0.0.1 -n 12 %_Nul_1_2%
  342. )
  343. exit /b
  344. ::==========================================
  345. :StopKMS
  346. :: Stop VLMCSD KMS Server
  347. taskkill /t /f /IM vlmcsd.exe %_Nul_1_2%
  348. exit /b
  349. ::==========================================
  350. :KMSGenuineTicket
  351. :: Enable/Disable KMS Genuine Ticket Validation registry key based on user parameter
  352. reg add "%_KMSGenuineKey%" /v NoGenTicket /t REG_DWORD /d %_KMSNoGenTicket% /f %_Nul_1_2%
  353. exit /b
  354. ::==========================================
  355. :CreateIFEOEntry
  356. :: Create DLL Injection Registry key based on parameter
  357. reg add "%_regKey%\%~1" /f /v "Debugger" /t REG_SZ /d "rundll32.exe SECOPatcher.dll,PatcherMain" %_Nul_1_2%
  358. exit /b
  359. ::==========================================
  360. :RemoveIFEOEntry
  361. :: Remove DLL Injection Registry key based on parameter
  362. if '%~1' NEQ 'osppsvc.exe' (
  363.   reg delete "%_regKey%\%~1" /f %_Nul_1_2%
  364. )
  365. if '%~1' EQU 'osppsvc.exe' (
  366.   reg delete "%_regKey%\%~1" /f /v "Debugger" %_Nul_1_2%
  367. )
  368. exit /b
  369. ::==========================================
  370. :StopService
  371. :: Stop service based on parameter
  372. sc query "%1" | findstr /i "STOPPED" %_Nul_1_2% || (
  373.   net stop "%1" /y %_Nul_1_2%
  374. )
  375. sc query "%1" | findstr /i "STOPPED" %_Nul_1_2% || (
  376.   sc stop "%1" %_Nul_1_2%
  377. )
  378. exit /b
  379. ::==========================================
  380. :SLSActivation
  381. reg delete "%_hkSPP%\55c92734-d682-4d71-983e-d6ec3f16059f" /f %_Nul_1_2%
  382. reg delete "%_hkSPP%\0ff1ce15-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  383. set "_MicrosoftProduct=SoftwareLicensingProduct"
  384. set "_MicrosoftService=SoftwareLicensingService"
  385.  
  386. :: Detect if Office 2013 [Volume Licensed] or Later is Installed
  387. wmic path %_MicrosoftProduct% where (Description like '%%KMSCLIENT%%') get Name /value %_Nul_2% | findstr /i "Office" %_Nul_1% && (
  388.   set /a _OfficeVL=1
  389. ) || (
  390.   set /a _OfficeVL=0
  391.   if %_WinBuild% GEQ 9200 (
  392.     echo.
  393.     echo No Office 2013 or Later Volume License Product Detected.
  394.   )
  395. )
  396.  
  397. :: Detect if installed Windows supports KMS Activation; Exit if there are no VolumeLicensed Windows or Office
  398. wmic path %_MicrosoftProduct% where (Description like '%%KMSCLIENT%%') get Name /value %_Nul_2% | findstr /i "Windows" %_Nul_1% || (
  399.   echo.
  400.   echo No Windows Volume License Product Detected.
  401.   if %_OfficeVL% EQU 0 (
  402.     exit /b
  403.   )
  404. )
  405.  
  406. :: Check if GVLK is installed for Windows
  407. wmic path %_MicrosoftProduct% where (Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL) get Name /value %_Nul_2% | findstr /i "Windows" %_Nul_1% && (
  408.   set /a _WindowsGVLK=1
  409. ) || (
  410.   set /a _WindowsGVLK=0
  411. )
  412.  
  413. :: Call Common Core Activation Routines
  414. call :CommonSLSandOSPS
  415. reg delete "%_hkSPP%\55c92734-d682-4d71-983e-d6ec3f16059f" /f %_Nul_1_2%
  416. reg delete "%_hkSPP%\0ff1ce15-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  417. reg delete "%_huSPP%\55c92734-d682-4d71-983e-d6ec3f16059f" /f %_Nul_1_2%
  418. reg delete "%_huSPP%\0ff1ce15-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  419. exit /b
  420. ::==========================================
  421. :OSPSActivation
  422. reg delete "%_hkOSPP%\59a52881-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  423. reg delete "%_hkOSPP%\0ff1ce15-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  424. set "_MicrosoftProduct=OfficeSoftwareProtectionProduct"
  425. set "_MicrosoftService=OfficeSoftwareProtectionService"
  426.  
  427. :: Determine if installed Office product is Retail or VL version; Exit if no VolumeLicensed Office is detected
  428. wmic path %_MicrosoftProduct% where (Description like '%%KMSCLIENT%%') get Name %_Nul_1_2% || (
  429.   if %_WinBuild% LSS 9200 (
  430.     echo.
  431.     echo No Office 2010 or Later Volume License Product Detected.
  432.     exit /b
  433.   ) else (
  434.     echo.
  435.     echo No Office 2010 Volume License Product Detected.
  436.     exit /b
  437.   )
  438. )
  439.  
  440. :: Call Common Core Activation Routines
  441. call :CommonSLSandOSPS
  442. reg delete "%_hkOSPP%\59a52881-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  443. reg delete "%_hkOSPP%\0ff1ce15-a989-479d-af46-f275c6370663" /f %_Nul_1_2%
  444. exit /b
  445. ::==========================================
  446. :CommonSLSandOSPS
  447. :: Get SoftwareLicensingService/OfficeSoftwareProtectionService version to set 'KMSHost' and 'KMSPort' values
  448. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftService% get Version /value"') do (
  449.   set "_Version=%%G"
  450. )
  451. wmic path %_MicrosoftService% where version='%_Version%' call SetKeyManagementServiceMachine MachineName="%_KMSHost%" %_Nul_1_2%
  452. wmic path %_MicrosoftService% where version='%_Version%' call SetKeyManagementServicePort %_KMSPort% %_Nul_1_2%
  453. :: This is available only on SoftwareLicensingService version 6.2 and later; Not available for OfficeSoftwareProtectionService
  454. if %_WinBuild% GEQ 9200 (
  455.   wmic path %_MicrosoftService% where version='%_Version%' call SetVLActivationTypeEnabled 2 %_Nul_1_2%
  456. )
  457.  
  458. :: For all the supported KMS Clients in SoftwareLicensingProduct/OfficeSoftwareProtectionProduct call 'CheckProduct'
  459. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where (Description like '%%KMSCLIENT%%') get ID /value"') do (
  460.   set "_ActivationID=%%G"
  461.   call :CheckProduct
  462. )
  463.  
  464. :: Clear KMS Server details from KMS Client, for Offline mode only
  465. if %_OfflineMode% EQU 1 (
  466.   wmic path %_MicrosoftService% where version='%_Version%' call ClearKeyManagementServiceMachine %_Nul_1_2%
  467.   wmic path %_MicrosoftService% where version='%_Version%' call ClearKeyManagementServicePort %_Nul_1_2%
  468.   wmic path %_MicrosoftService% where version='%_Version%' call DisableKeyManagementServiceDnsPublishing 1 %_Nul_1_2%
  469.   wmic path %_MicrosoftService% where version='%_Version%' call DisableKeyManagementServiceHostCaching 1 %_Nul_1_2%
  470.   REM This is available only on SoftwareLicensingService version 6.2 and later; Not available for OfficeSoftwareProtectionService
  471.   if %_WinBuild% GEQ 9200 (
  472.     wmic path %_MicrosoftService% where version='%_Version%' call ClearVLActivationTypeEnabled %_Nul_1_2%
  473.   )
  474. )
  475. exit /b
  476. ::==========================================
  477. :CheckProduct
  478. :: Detect Office Products
  479. set /a _OfficeSLP=0
  480. wmic path %_MicrosoftProduct% where ID='%_ActivationID%' get Name /value | findstr /i "Office" %_Nul_1% && (
  481.   set /a _OfficeSLP=1
  482. )
  483. :: If Detected KMS Client is already activated earlier OR has GVLK, call Activate function
  484. if %_OfficeSLP% EQU 0 wmic path %_MicrosoftProduct% where ID='%_ActivationID%' get LicenseStatus | findstr "1" %_Nul_1_2% && (
  485.   call :Activate %_ActivationID%
  486.   exit /b
  487. )
  488. wmic path %_MicrosoftProduct% where (PartialProductKey is not NULL) get ID | findstr /i "%_ActivationID%" %_Nul_1_2% && (
  489.   call :Activate %_ActivationID%
  490.   exit /b
  491. )
  492. :: Skip for Unnecessary Products
  493. if %_OfficeSLP% EQU 0 (
  494.   if %_WindowsGVLK% EQU 1 (
  495.     exit /b
  496.   )
  497. )
  498. :: Ugly hack for multiple Windows 10 SKU-IDs
  499. for %%G in (
  500.   b71515d9-89a2-4c60-88c8-656fbcca7f3a
  501.   5b2add49-b8f4-42e0-a77c-adad4efeeeb1
  502.   af43f7f0-3b1e-4266-a123-1fdb53f4323b
  503.   075aca1f-05d7-42e5-a3ce-e349e7be7078
  504.   2cf5af84-abab-4ff0-83f8-f040fb2576eb
  505.   11a37f09-fb7f-4002-bd84-f3ae71d11e90
  506.   43f2ab05-7c87-4d56-b27c-44d0f9a3dabd
  507.   6ae51eeb-c268-4a21-9aae-df74c38b586d
  508.   ff808201-fec6-4fd4-ae16-abbddade5706
  509.   34260150-69ac-49a3-8a0d-4a403ab55763
  510.   903663f7-d2ab-49c9-8942-14aa9e0a9c72
  511.   4dfd543d-caa6-4f69-a95f-5ddfe2b89567
  512.   5fe40dd6-cf1f-4cf2-8729-92121ac2e997
  513.   2cc171ef-db48-4adc-af09-7c574b37f139
  514. ) do (
  515.   if /i '%_ActivationID%' EQU '%%G' (
  516.     exit /b
  517.   )
  518. )
  519.  
  520. :: If Detected KMS Client do not have GVLK, do checks for permanent activation, then install GVLK and activate it
  521. for /f "tokens=3 delims==, " %%G in ('"wmic path %_MicrosoftProduct% where ID='%_ActivationID%' get Name /value"') do (
  522.   set "_ProductName=%%G"
  523. )
  524. if '%_ProductName%' EQU '19' (
  525.   if %_Office16% EQU 0 (
  526.     exit /b
  527.   )
  528.   call :CheckOffice19 %_ActivationID%
  529.   exit /b
  530. ) else if '%_ProductName%' EQU '16' (
  531.   if %_Office16% EQU 0 (
  532.     exit /b
  533.   )
  534.   call :CheckOffice16 %_ActivationID%
  535.   exit /b
  536. ) else if '%_ProductName%' EQU '15' (
  537.   if %_Office15% EQU 0 (
  538.     exit /b
  539.   )
  540.   call :CheckOffice15 %_ActivationID%
  541.   exit /b
  542. ) else if '%_ProductName%' EQU '14' (
  543.   if %_Office14% EQU 0 (
  544.     exit /b
  545.   )
  546.   call :CheckOffice14 %_ActivationID%
  547.   exit /b
  548. )
  549.  
  550. :: Pre Windows 10 build 1607 do not have combined editions
  551. if not defined _Edition (
  552.   call :CheckWindows %_ActivationID%
  553.   exit /b
  554. )
  555. :: Ugly hack for combined editions in Windows 10 installation
  556. if /i '%_ActivationID%' EQU '2de67392-b7a7-462a-b1ca-108dd189f588' (
  557.   if /i %_Edition% NEQ Professional (
  558.     exit /b
  559.   )
  560. )
  561. if /i '%_ActivationID%' EQU 'a80b5abf-76ad-428b-b05d-a47d2dffeebf' (
  562.   if /i %_Edition% NEQ ProfessionalN (
  563.     exit /b
  564.   )
  565. )
  566. if /i '%_ActivationID%' EQU '82bbc092-bc50-4e16-8e18-b74fc486aec3' (
  567.   if /i %_Edition% NEQ ProfessionalWorkstation (
  568.     exit /b
  569.   )
  570. )
  571. if /i '%_ActivationID%' EQU '4b1571d3-bafb-4b40-8087-a961be2caf65' (
  572.   if /i %_Edition% NEQ ProfessionalWorkstationN (
  573.     exit /b
  574.   )
  575. )
  576. if /i '%_ActivationID%' EQU '3f1afc82-f8ac-4f6c-8005-1d233e606eee' (
  577.   if /i %_Edition% NEQ ProfessionalEducation (
  578.     exit /b
  579.   )
  580. )
  581. if /i '%_ActivationID%' EQU '5300b18c-2e33-4dc2-8291-47ffcec746dd' (
  582.   if /i %_Edition% NEQ ProfessionalEducationN (
  583.     exit /b
  584.   )
  585. )
  586. if /i '%_ActivationID%' EQU '73111121-5638-40f6-bc11-f1d7b0d64300' (
  587.   if /i %_Edition% NEQ Enterprise (
  588.     exit /b
  589.   )
  590. )
  591. if /i '%_ActivationID%' EQU 'e272e3e2-732f-4c65-a8f0-484747d0d947' (
  592.   if /i %_Edition% NEQ EnterpriseN (
  593.     exit /b
  594.   )
  595. )
  596. if /i '%_ActivationID%' EQU 'e0c42288-980c-4788-a014-c080d2e1926e' (
  597.   if /i %_Edition% NEQ Education (
  598.     exit /b
  599.   )
  600. )
  601. if /i '%_ActivationID%' EQU '3c102355-d027-42c6-ad23-2e7ef8a02585' (
  602.   if /i %_Edition% NEQ EducationN (
  603.     exit /b
  604.   )
  605. )
  606. if /i '%_ActivationID%' EQU 'e4db50ea-bda1-4566-b047-0ca50abc6f07' (
  607.   if /i %_Edition% NEQ ServerRdsh (
  608.     exit /b
  609.   )
  610. )
  611. if /i '%_ActivationID%' EQU 'ec868e65-fadf-4759-b23e-93fe37f2cc29' (
  612.   if /i %_Edition% NEQ ServerRdsh (
  613.     exit /b
  614.   )
  615. )
  616. if /i '%_ActivationID%' EQU '58e97c99-f377-4ef1-81d5-4ad5522b5fd8' (
  617.   if /i %_Edition% NEQ Core (
  618.     exit /b
  619.   )
  620. )
  621. if /i '%_ActivationID%' EQU 'cd918a57-a41b-4c82-8dce-1a538e221a83' (
  622.   if /i %_Edition% NEQ CoreSingleLanguage (
  623.     exit /b
  624.   )
  625. )
  626. call :CheckWindows %_ActivationID%
  627. exit /b
  628. ::==========================================
  629. :CheckWindows
  630. wmic path %_MicrosoftProduct% where (LicenseStatus='1' and GracePeriodRemaining='0') get Name %_Nul_2% | findstr /i "Windows" %_Nul_1% && (
  631.   echo.
  632.   echo Detected Windows %_ProductName% is permanently activated.
  633.   exit /b
  634. )
  635.  
  636. :: If Windows is not permanently activated, Install GVLK and Activate
  637. call :SelectKey %1
  638. exit /b
  639. ::==========================================
  640. :CheckOffice19
  641. :: Ugly check for old volume licenses of Office 2019 Pro SKUs
  642. if /i '%1' EQU '0bc88885-718c-491d-921f-6f214349e79c' (
  643.   exit /b
  644. )
  645. if /i '%1' EQU 'fc7c4d0c-2e85-4bb9-afd4-01ed1476b5e9' (
  646.   exit /b
  647. )
  648. if /i '%1' EQU '500f6619-ef93-4b75-bcb4-82819998a3ca' (
  649.   exit /b
  650. )
  651. if /i '%1' EQU '85dd8b5f-eaa4-4af3-a628-cce9e77c9a03' (
  652.   wmic path %_MicrosoftProduct% where 'PartialProductKey is not NULL' get ID | findstr /i "0bc88885-718c-491d-921f-6f214349e79c" %_Nul_1_2% && (
  653.     exit /b
  654.   )
  655. )
  656. if /i '%1' EQU '2ca2bf3f-949e-446a-82c7-e25a15ec78c4' (
  657.   wmic path %_MicrosoftProduct% where 'PartialProductKey is not NULL' get ID | findstr /i "fc7c4d0c-2e85-4bb9-afd4-01ed1476b5e9" %_Nul_1_2% && (
  658.     exit /b
  659.   )
  660. )
  661. if /i '%1' EQU '5b5cf08f-b81a-431d-b080-3450d8620565' (
  662.   wmic path %_MicrosoftProduct% where 'PartialProductKey is not NULL' get ID | findstr /i "500f6619-ef93-4b75-bcb4-82819998a3ca" %_Nul_1_2% && (
  663.     exit /b
  664.   )
  665. )
  666. if /i '%1' EQU '85dd8b5f-eaa4-4af3-a628-cce9e77c9a03' (
  667.   call :CheckOffice "%1" "19ProPlus2019VL_MAK_AE" "Office ProPlus 2019" "19ProPlus2019XC2RVL_MAKC2R" "Office ProPlus 2019 C2R"
  668.   exit /b
  669. )
  670. if /i '%1' EQU '6912a74b-a5fb-401a-bfdb-2e3ab46f4b02' (
  671.   call :CheckOffice "%1" "19Standard2019VL_MAK_AE" "Office Standard 2019"
  672.   exit /b
  673. )
  674. if /i '%1' EQU '2ca2bf3f-949e-446a-82c7-e25a15ec78c4' (
  675.   call :CheckOffice "%1" "19ProjectPro2019VL_MAK_AE" "Project Pro 2019" "19ProjectPro2019XC2RVL_MAKC2R" "Project Pro 2019 C2R"
  676.   exit /b
  677. )
  678. if /i '%1' EQU '1777f0e3-7392-4198-97ea-8ae4de6f6381' (
  679.   call :CheckOffice "%1" "19ProjectStd2019VL_MAK_AE" "Project Standard 2019"
  680.   exit /b
  681. )
  682. if /i '%1' EQU '5b5cf08f-b81a-431d-b080-3450d8620565' (
  683.   call :CheckOffice "%1" "19VisioPro2019VL_MAK_AE" "Visio Pro 2019" "19VisioPro2019XC2RVL_MAKC2R" "Visio Pro 2019 C2R"
  684.   exit /b
  685. )
  686. if /i '%1' EQU 'e06d7df3-aad0-419d-8dfb-0ac37e2bdf39' (
  687.   call :CheckOffice "%1" "19VisioStd2019VL_MAK_AE" "Visio Standard 2019"
  688.   exit /b
  689. )
  690. call :SelectKey %1
  691. exit /b
  692. ::==========================================
  693. :CheckOffice16
  694. if /i '%1' EQU '9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce' (
  695.   call :CheckOffice "%1" "16MondoVL_MAK" "Office Mondo 2016"
  696.   exit /b
  697. )
  698. if /i '%1' EQU 'd450596f-894d-49e0-966a-fd39ed4c4c64' (
  699.   call :CheckOffice "%1" "16ProPlusVL_MAK" "Office ProPlus 2016"
  700.   exit /b
  701. )
  702. if /i '%1' EQU 'dedfa23d-6ed1-45a6-85dc-63cae0546de6' (
  703.   call :CheckOffice "%1" "16StandardVL_MAK" "Office Standard 2016"
  704.   exit /b
  705. )
  706. if /i '%1' EQU '4f414197-0fc2-4c01-b68a-86cbb9ac254c' (
  707.   call :CheckOffice "%1" "16ProjectProVL_MAK" "Project Pro 2016"
  708.   exit /b
  709. )
  710. if /i '%1' EQU 'da7ddabc-3fbe-4447-9e01-6ab7440b4cd4' (
  711.   call :CheckOffice "%1" "16ProjectStdVL_MAK" "Project Standard 2016"
  712.   exit /b
  713. )
  714. if /i '%1' EQU '6bf301c1-b94a-43e9-ba31-d494598c47fb' (
  715.   call :CheckOffice "%1" "16VisioProVL_MAK" "Visio Pro 2016"
  716.   exit /b
  717. )
  718. if /i '%1' EQU 'aa2a7821-1827-4c2c-8f1d-4513a34dda97' (
  719.   call :CheckOffice "%1" "16VisioStdVL_MAK" "Visio Standard 2016"
  720.   exit /b
  721. )
  722. if /i '%1' EQU '829b8110-0e6f-4349-bca4-42803577788d' (
  723.   call :CheckOffice "%1" "16ProjectProXC2RVL_MAKC2R" "Project Pro 2016 C2R"
  724.   exit /b
  725. )
  726. if /i '%1' EQU 'cbbaca45-556a-4416-ad03-bda598eaa7c8' (
  727.   call :CheckOffice "%1" "16ProjectStdXC2RVL_MAKC2R" "Project Standard 2016 C2R"
  728.   exit /b
  729. )
  730. if /i '%1' EQU 'b234abe3-0857-4f9c-b05a-4dc314f85557' (
  731.   call :CheckOffice "%1" "16VisioProXC2RVL_MAKC2R" "Visio Pro 2016 C2R"
  732.   exit /b
  733. )
  734. if /i '%1' EQU '361fe620-64f4-41b5-ba77-84f8e079b1f7' (
  735.   call :CheckOffice "%1" "16VisioStdXC2RVL_MAKC2R" "Visio Standard 2016 C2R"
  736.   exit /b
  737. )
  738. call :SelectKey %1
  739. exit /b
  740. ::==========================================
  741. :CheckOffice15
  742. if /i '%1' EQU 'dc981c6b-fc8e-420f-aa43-f8f33e5c0923' (
  743.   call :CheckOffice "%1" "MondoVL_MAK" "Office Mondo 2013"
  744.   exit /b
  745. )
  746. if /i '%1' EQU 'b322da9c-a2e2-4058-9e4e-f59a6970bd69' (
  747.   call :CheckOffice "%1" "ProPlusVL_MAK" "Office ProPlus 2013"
  748.   exit /b
  749. )
  750. if /i '%1' EQU 'b13afb38-cd79-4ae5-9f7f-eed058d750ca' (
  751.   call :CheckOffice "%1" "StandardVL_MAK" "Office Standard 2013"
  752.   exit /b
  753. )
  754. if /i '%1' EQU '4a5d124a-e620-44ba-b6ff-658961b33b9a' (
  755.   call :CheckOffice "%1" "ProjectProVL_MAK" "Project Pro 2013"
  756.   exit /b
  757. )
  758. if /i '%1' EQU '427a28d1-d17c-4abf-b717-32c780ba6f07' (
  759.   call :CheckOffice "%1" "ProjectStdVL_MAK" "Project Standard 2013"
  760.   exit /b
  761. )
  762. if /i '%1' EQU 'e13ac10e-75d0-4aff-a0cd-764982cf541c' (
  763.   call :CheckOffice "%1" "VisioProVL_MAK" "Visio Pro 2013"
  764.   exit /b
  765. )
  766. if /i '%1' EQU 'ac4efaf0-f81f-4f61-bdf7-ea32b02ab117' (
  767.   call :CheckOffice "%1" "VisioStdVL_MAK" "Visio Standard 2013"
  768.   exit /b
  769. )
  770. call :SelectKey %1
  771. exit /b
  772. ::==========================================
  773. :CheckOffice14
  774. set "_VisioPremium="
  775. set "_VisioPro="
  776. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where (Name like '%%OfficeVisioPrem-MAK%%') get LicenseStatus /value" %_Nul_2e%') do (
  777.   set /a _VisioPremium=%%G
  778. )
  779. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where (Name like '%%OfficeVisioPro-MAK%%') get LicenseStatus /value" %_Nul_2e%') do (
  780.   set /a _VisioPro=%%G
  781. )
  782. if /i '%1' EQU '09ed9640-f020-400a-acd8-d7d867dfd9c2' (
  783.   call :CheckOffice "%1" "Mondo-MAK" "Office Mondo 2010"
  784.   exit /b
  785. )
  786. if /i '%1' EQU '6f327760-8c5c-417c-9b61-836a98287e0c' (
  787.   call :CheckOffice "%1" "ProPlus-MAK" "Office ProPlus 2010" "ProPlusAcad-MAK" "Office Professional Academic 2010"
  788.   exit /b
  789. )
  790. if /i '%1' EQU '9da2a678-fb6b-4e67-ab84-60dd6a9c819a' (
  791.   call :CheckOffice "%1" "Standard-MAK" "Office Standard 2010"
  792.   exit /b
  793. )
  794. if /i '%1' EQU 'ea509e87-07a1-4a45-9edc-eba5a39f36af' (
  795.   call :CheckOffice "%1" "SmallBusBasics-MAK" "Office Home and Business 2010"
  796.   exit /b
  797. )
  798. if /i '%1' EQU 'df133ff7-bf14-4f95-afe3-7b48e7e331ef' (
  799.   call :CheckOffice "%1" "ProjectPro-MAK" "Project Pro 2010"
  800.   exit /b
  801. )
  802. if /i '%1' EQU '5dc7bf61-5ec9-4996-9ccb-df806a2d0efe' (
  803.   call :CheckOffice "%1" "ProjectStd-MAK" "Project Standard 2010"
  804.   exit /b
  805. )
  806. if /i '%1' EQU '92236105-bb67-494f-94c7-7f7a607929bd' (
  807.   call :CheckOffice "%1" "VisioPrem-MAK" "Visio Premium 2010" "VisioPro-MAK" "Visio Pro 2010"
  808.   exit /b
  809. )
  810. if defined _VisioPremium exit /b
  811. if /i '%1' EQU 'e558389c-83c3-4b29-adfe-5e4d7f46c358' (
  812.   call :CheckOffice "%1" "VisioPro-MAK" "Visio Pro 2010" "VisioStd-MAK" "Visio Standard 2010"
  813.   exit /b
  814. )
  815. if defined _VisioPro exit /b
  816. if /i '%1' EQU '9ed833ff-4f92-4f36-b370-8683a4f13275' (
  817.   call :CheckOffice "%1" "VisioStd-MAK" "Visio Standard 2010"
  818.   exit /b
  819. )
  820. call :SelectKey %1
  821. exit /b
  822. ::==========================================
  823. :CheckOffice
  824. set /a _License=0
  825. set /a _License2=0
  826. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where (Name like '%%Office%~2%%') get LicenseStatus /VALUE" %_Nul_2e%') do (
  827.   set /a _License=%%G
  828. )
  829. if "%~4" NEQ "" (
  830.   for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where (Name like '%%Office%~4%%') get LicenseStatus /VALUE" %_Nul_2e%') do (
  831.     set /a _License2=%%G
  832.   )
  833. )
  834. if "%_License2%" EQU "1" (
  835.   echo Detected %5 is permanently MAK activated.
  836.   exit /b
  837. )
  838. if "%_License%" EQU "1" (
  839.   echo Detected %3 is permanently MAK activated.
  840.   exit /b
  841. )
  842. :: If Office product is not permanently activated, Install GVLK and Activate
  843. call :SelectKey %1
  844. exit /b
  845. ::==========================================
  846. :OfficeDetect
  847. set _Office%1=0
  848. for /f "tokens=2*" %%G in ('"reg query HKLM\SOFTWARE\Microsoft\Office\%1.0\Common\InstallRoot /v Path" %_Nul_2e%') do if exist "%%H\OSPP.VBS" (
  849.   set _Office%1=1
  850. )
  851. for /f "tokens=2*" %%G in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\%1.0\Common\InstallRoot /v Path" %_Nul_2e%') do if exist "%%H\OSPP.VBS" (
  852.   set _Office%1=1
  853. )
  854. if exist "%ProgramFiles%\Microsoft Office\Office%1\OSPP.VBS" (
  855.   set _Office%1=1
  856. )
  857. if exist "%ProgramFiles(x86)%\Microsoft Office\Office%1\OSPP.VBS" (
  858.   set _Office%1=1
  859. )
  860. exit /b
  861. ::==========================================
  862. :VisualStudio
  863. :: Clear variable to avoid confliction if multiple Visual Studio versions installed
  864. set "_VS="
  865. if "%_OSarch%" EQU "64-bit" (
  866.   set "_H64=SOFTWARE\WOW6432Node"
  867. ) else (
  868.   set "_H64=SOFTWARE"
  869. )
  870. for /f "skip=2 tokens=2*" %%G in ('"reg query HKLM\%_H64%\Microsoft\VisualStudio\%~1 /v %~2" %_Nul_2e%') do (
  871.   set "_VS=%%H%~3"
  872. )
  873. if not exist "%_VS%\StorePID.exe" (
  874.   exit /b
  875. )
  876. start "" /b "%_VS%\StorePID.exe" %~4 %~5 && (
  877.   echo Visual Studio %~6 activated successfully.
  878.   echo.
  879. ) || (
  880.   echo Visual Studio %~6 activation failed.
  881.   echo.
  882. )
  883. exit /b
  884. ::==========================================
  885. :Activate
  886. :: Clear any manually set KMSHostIP and KMSPort with /skms or /sethst; Since they override KMSHostIP and KMSPort values set for SLS/OSPS
  887. wmic path %_MicrosoftProduct% where ID='%1' call ClearKeyManagementServiceMachine %_Nul_1_2%
  888. wmic path %_MicrosoftProduct% where ID='%1' call ClearKeyManagementServicePort %_Nul_1_2%
  889.  
  890. :: Call Activate method of the corresponding KMS Client
  891. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where ID='%1' get Name /value"') do (
  892.   echo.
  893.   echo Attempting to activate %%G
  894. )
  895. wmic path %_MicrosoftProduct% where ID='%1' call Activate %_Nul_1_2%
  896. set ERRORCODE=%ERRORLEVEL%
  897.  
  898. :: Get Remaining Grace Period of the KMS Client
  899. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where ID='%1' get GracePeriodRemaining /value"') do (
  900.   set /a _gprMinutes=%%G
  901.   set /a _gprDays=%%G/1440
  902. )
  903. if %_gprMinutes% EQU 43200 (
  904.   if %_WinBuild% EQU 9200 if %_OfficeSLP% EQU 0 (
  905.     echo Windows 8 Core/ProfessionalWMC Activation Successful
  906.     echo Remaining Period: %_gprDays% days ^(%_gprMinutes% minutes^)
  907.     exit /b
  908.   )
  909. )
  910. if %_gprMinutes% EQU 64800 (
  911.   echo Windows Core/ProfessionalWMC Activation Successful
  912.   echo Remaining Period: %_gprDays% days ^(%_gprMinutes% minutes^)
  913.   exit /b
  914. )
  915. if %_gprMinutes% EQU 216000000 (
  916.   if %_WinBuild% GEQ 15063 (
  917.     echo Windows 10 Enterprise G/GN Activation Successful
  918.     echo Remaining Period: %_gprDays% days ^(%_gprMinutes% minutes^)
  919.     exit /b
  920.   )
  921. )
  922. if %_gprMinutes% EQU 259200 (
  923.   echo Activation Successful
  924. ) else (
  925.   call cmd /c exit /b %ERRORCODE%
  926.   echo Activation Failed: 0x%=ExitCode%
  927. )
  928. echo Remaining Period: %_gprDays% days ^(%_gprMinutes% minutes^)
  929. exit /b
  930. ::==========================================
  931. :SelectKey
  932. :: Select GenericVolumeLicenseKey based on Activation-ID (SKU-ID) and Install it, if found
  933. for /f "tokens=2 delims==" %%G in ('"wmic path %_MicrosoftProduct% where ID='%1' get Name /value"') do (
  934.   set "_Name=%%G"
  935.   echo.
  936.   echo Searching GenericVolumeLicenseKey for %%G
  937.   goto :%1 %_Nul_2% || goto :KeyNotFound
  938. )
  939. ::==========================================
  940. :: Office 2019 Professional Plus
  941. :85dd8b5f-eaa4-4af3-a628-cce9e77c9a03
  942. set "_key=NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP"
  943. goto :InstallKey
  944. :: Office 2019 Standard
  945. :6912a74b-a5fb-401a-bfdb-2e3ab46f4b02
  946. set "_key=6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK"
  947. goto :InstallKey
  948. :: Project 2019 Professional
  949. :2ca2bf3f-949e-446a-82c7-e25a15ec78c4
  950. set "_key=B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B"
  951. goto :InstallKey
  952. :: Project 2019 Standard
  953. :1777f0e3-7392-4198-97ea-8ae4de6f6381
  954. set "_key=C4F7P-NCP8C-6CQPT-MQHV9-JXD2M"
  955. goto :InstallKey
  956. :: Visio 2019 Professional
  957. :5b5cf08f-b81a-431d-b080-3450d8620565
  958. set "_key=9BGNQ-K37YR-RQHF2-38RQ3-7VCBB"
  959. goto :InstallKey
  960. :: Visio 2019 Standard
  961. :e06d7df3-aad0-419d-8dfb-0ac37e2bdf39
  962. set "_key=7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2"
  963. goto :InstallKey
  964. :: Access 2019
  965. :9e9bceeb-e736-4f26-88de-763f87dcc485
  966. set "_key=9N9PT-27V4Y-VJ2PD-YXFMF-YTFQT"
  967. goto :InstallKey
  968. :: Excel 2019
  969. :237854e9-79fc-4497-a0c1-a70969691c6b
  970. set "_key=TMJWT-YYNMB-3BKTF-644FC-RVXBD"
  971. goto :InstallKey
  972. :: Outlook 2019
  973. :c8f8a301-19f5-4132-96ce-2de9d4adbd33
  974. set "_key=7HD7K-N4PVK-BHBCQ-YWQRW-XW4VK"
  975. goto :InstallKey
  976. :: PowerPoint 2019
  977. :3131fd61-5e4f-4308-8d6d-62be1987c92c
  978. set "_key=RRNCX-C64HY-W2MM7-MCH9G-TJHMQ"
  979. goto :InstallKey
  980. :: Publisher 2019
  981. :9d3e4cca-e172-46f1-a2f4-1d2107051444
  982. set "_key=G2KWX-3NW6P-PY93R-JXK2T-C9Y9V"
  983. goto :InstallKey
  984. :: Skype for Business 2019
  985. :734c6c6e-b0ba-4298-a891-671772b2bd1b
  986. set "_key=NCJ33-JHBBY-HTK98-MYCV8-HMKHJ"
  987. goto :InstallKey
  988. :: Word 2019
  989. :059834fe-a8ea-4bff-b67b-4d006b5447d3
  990. set "_key=PBX3G-NWMT6-Q7XBW-PYJGG-WXD33"
  991. goto :InstallKey
  992. :: Office 2019 Professional Plus C2R-P
  993. :0bc88885-718c-491d-921f-6f214349e79c
  994. set "_key=VQ9DP-NVHPH-T9HJC-J9PDT-KTQRG"
  995. goto :InstallKey
  996. :: Project 2019 Professional C2R-P
  997. :fc7c4d0c-2e85-4bb9-afd4-01ed1476b5e9
  998. set "_key=XM2V9-DN9HH-QB449-XDGKC-W2RMW"
  999. goto :InstallKey
  1000. :: Visio 2019 Professional C2R-P
  1001. :500f6619-ef93-4b75-bcb4-82819998a3ca
  1002. set "_key=N2CG9-YD3YK-936X4-3WR82-Q3X4H"
  1003. goto :InstallKey
  1004. ::==========================================
  1005. :: Office 2016 Mondo
  1006. :9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce
  1007. set "_key=HFTND-W9MK4-8B7MJ-B6C4G-XQBR2"
  1008. goto :InstallKey
  1009. :: Office 2016 Professional Plus
  1010. :d450596f-894d-49e0-966a-fd39ed4c4c64
  1011. set "_key=XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99"
  1012. goto :InstallKey
  1013. :: Office 2016 Standard
  1014. :dedfa23d-6ed1-45a6-85dc-63cae0546de6
  1015. set "_key=JNRGM-WHDWX-FJJG3-K47QV-DRTFM"
  1016. goto :InstallKey
  1017. :: Project 2016 Professional
  1018. :4f414197-0fc2-4c01-b68a-86cbb9ac254c
  1019. set "_key=YG9NW-3K39V-2T3HJ-93F3Q-G83KT"
  1020. goto :InstallKey
  1021. :: Project 2016 Standard
  1022. :da7ddabc-3fbe-4447-9e01-6ab7440b4cd4
  1023. set "_key=GNFHQ-F6YQM-KQDGJ-327XX-KQBVC"
  1024. goto :InstallKey
  1025. :: Visio 2016 Professional
  1026. :6bf301c1-b94a-43e9-ba31-d494598c47fb
  1027. set "_key=PD3PC-RHNGV-FXJ29-8JK7D-RJRJK"
  1028. goto :InstallKey
  1029. :: Visio 2016 Standard
  1030. :aa2a7821-1827-4c2c-8f1d-4513a34dda97
  1031. set "_key=7WHWN-4T7MP-G96JF-G33KR-W8GF4"
  1032. goto :InstallKey
  1033. :: Access 2016
  1034. :67c0fc0c-deba-401b-bf8b-9c8ad8395804
  1035. set "_key=GNH9Y-D2J4T-FJHGG-QRVH7-QPFDW"
  1036. goto :InstallKey
  1037. :: Excel 2016
  1038. :c3e65d36-141f-4d2f-a303-a842ee756a29
  1039. set "_key=9C2PK-NWTVB-JMPW8-BFT28-7FTBF"
  1040. goto :InstallKey
  1041. :: OneNote 2016
  1042. :d8cace59-33d2-4ac7-9b1b-9b72339c51c8
  1043. set "_key=DR92N-9HTF2-97XKM-XW2WJ-XW3J6"
  1044. goto :InstallKey
  1045. :: Outlook 2016
  1046. :ec9d9265-9d1e-4ed0-838a-cdc20f2551a1
  1047. set "_key=R69KK-NTPKF-7M3Q4-QYBHW-6MT9B"
  1048. goto :InstallKey
  1049. :: PowerPoint 2016
  1050. :d70b1bba-b893-4544-96e2-b7a318091c33
  1051. set "_key=J7MQP-HNJ4Y-WJ7YM-PFYGF-BY6C6"
  1052. goto :InstallKey
  1053. :: Publisher 2016
  1054. :041a06cb-c5b8-4772-809f-416d03d16654
  1055. set "_key=F47MM-N3XJP-TQXJ9-BP99D-8K837"
  1056. goto :InstallKey
  1057. :: Skype for Business 2016
  1058. :83e04ee1-fa8d-436d-8994-d31a862cab77
  1059. set "_key=869NQ-FJ69K-466HW-QYCP2-DDBV6"
  1060. goto :InstallKey
  1061. :: Word 2016
  1062. :bb11badf-d8aa-470e-9311-20eaf80fe5cc
  1063. set "_key=WXY84-JN2Q9-RBCCQ-3Q3J3-3PFJ6"
  1064. goto :InstallKey
  1065. :: Project 2016 Professional C2R-P
  1066. :829b8110-0e6f-4349-bca4-42803577788d
  1067. set "_key=WGT24-HCNMF-FQ7XH-6M8K7-DRTW9"
  1068. goto :InstallKey
  1069. :: Project 2016 Standard C2R-P
  1070. :cbbaca45-556a-4416-ad03-bda598eaa7c8
  1071. set "_key=D8NRQ-JTYM3-7J2DX-646CT-6836M"
  1072. goto :InstallKey
  1073. :: Visio 2016 Professional C2R-P
  1074. :b234abe3-0857-4f9c-b05a-4dc314f85557
  1075. set "_key=69WXN-MBYV6-22PQG-3WGHK-RM6XC"
  1076. goto :InstallKey
  1077. :: Visio 2016 Standard C2R-P
  1078. :361fe620-64f4-41b5-ba77-84f8e079b1f7
  1079. set "_key=NY48V-PPYYH-3F4PX-XJRKJ-W4423"
  1080. goto :InstallKey
  1081. :: Office 2016 MondoR Automation
  1082. :e914ea6e-a5fa-4439-a394-a9bb3293ca09
  1083. set "_key=DMTCJ-KNRKX-26982-JYCKT-P7KB6"
  1084. goto :InstallKey
  1085. ::==========================================
  1086. :: Office 2013 Mondo
  1087. :dc981c6b-fc8e-420f-aa43-f8f33e5c0923
  1088. set "_key=42QTK-RN8M7-J3C4G-BBGYM-88CYV"
  1089. goto :InstallKey
  1090. :: Office 2013 Professional Plus
  1091. :b322da9c-a2e2-4058-9e4e-f59a6970bd69
  1092. set "_key=YC7DK-G2NP3-2QQC3-J6H88-GVGXT"
  1093. goto :InstallKey
  1094. :: Office 2013 Standard
  1095. :b13afb38-cd79-4ae5-9f7f-eed058d750ca
  1096. set "_key=KBKQT-2NMXY-JJWGP-M62JB-92CD4"
  1097. goto :InstallKey
  1098. :: Project 2013 Professional
  1099. :4a5d124a-e620-44ba-b6ff-658961b33b9a
  1100. set "_key=FN8TT-7WMH6-2D4X9-M337T-2342K"
  1101. goto :InstallKey
  1102. :: Project 2013 Standard
  1103. :427a28d1-d17c-4abf-b717-32c780ba6f07
  1104. set "_key=6NTH3-CW976-3G3Y2-JK3TX-8QHTT"
  1105. goto :InstallKey
  1106. :: Visio 2013 Professional
  1107. :e13ac10e-75d0-4aff-a0cd-764982cf541c
  1108. set "_key=C2FG9-N6J68-H8BTJ-BW3QX-RM3B3"
  1109. goto :InstallKey
  1110. :: Visio 2013 Standard
  1111. :ac4efaf0-f81f-4f61-bdf7-ea32b02ab117
  1112. set "_key=J484Y-4NKBF-W2HMG-DBMJC-PGWR7"
  1113. goto :InstallKey
  1114. :: Access 2013
  1115. :6ee7622c-18d8-4005-9fb7-92db644a279b
  1116. set "_key=NG2JY-H4JBT-HQXYP-78QH9-4JM2D"
  1117. goto :InstallKey
  1118. :: Excel 2013
  1119. :f7461d52-7c2b-43b2-8744-ea958e0bd09a
  1120. set "_key=VGPNG-Y7HQW-9RHP7-TKPV3-BG7GB"
  1121. goto :InstallKey
  1122. :: OneDrive for Business 2013 (Groove)
  1123. :fb4875ec-0c6b-450f-b82b-ab57d8d1677f
  1124. set "_key=H7R7V-WPNXQ-WCYYC-76BGV-VT7GH"
  1125. goto :InstallKey
  1126. :: InfoPath 2013
  1127. :a30b8040-d68a-423f-b0b5-9ce292ea5a8f
  1128. set "_key=DKT8B-N7VXH-D963P-Q4PHY-F8894"
  1129. goto :InstallKey
  1130. :: Lync 2013
  1131. :1b9f11e3-c85c-4e1b-bb29-879ad2c909e3
  1132. set "_key=2MG3G-3BNTT-3MFW9-KDQW3-TCK7R"
  1133. goto :InstallKey
  1134. :: OneNote 2013
  1135. :efe1f3e6-aea2-4144-a208-32aa872b6545
  1136. set "_key=TGN6P-8MMBC-37P2F-XHXXK-P34VW"
  1137. goto :InstallKey
  1138. :: Outlook 2013
  1139. :771c3afa-50c5-443f-b151-ff2546d863a0
  1140. set "_key=QPN8Q-BJBTJ-334K3-93TGY-2PMBT"
  1141. goto :InstallKey
  1142. :: PowerPoint 2013
  1143. :8c762649-97d1-4953-ad27-b7e2c25b972e
  1144. set "_key=4NT99-8RJFH-Q2VDH-KYG2C-4RD4F"
  1145. goto :InstallKey
  1146. :: Publisher 2013
  1147. :00c79ff1-6850-443d-bf61-71cde0de305f
  1148. set "_key=PN2WF-29XG2-T9HJ7-JQPJR-FCXK4"
  1149. goto :InstallKey
  1150. :: Word 2013
  1151. :d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3
  1152. set "_key=6Q7VD-NX8JD-WJ2VH-88V73-4GBJ7"
  1153. goto :InstallKey
  1154. ::==========================================
  1155. :: Office 2010 Professional Plus
  1156. :6f327760-8c5c-417c-9b61-836a98287e0c
  1157. set "_key=VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB"
  1158. goto :InstallKey
  1159. :: Office 2010 Standard
  1160. :9da2a678-fb6b-4e67-ab84-60dd6a9c819a
  1161. set "_key=V7QKV-4XVVR-XYV4D-F7DFM-8R6BM"
  1162. goto :InstallKey
  1163. :: Access 2010
  1164. :8ce7e872-188c-4b98-9d90-f8f90b7aad02
  1165. set "_key=V7Y44-9T38C-R2VJK-666HK-T7DDX"
  1166. goto :InstallKey
  1167. :: Excel 2010
  1168. :cee5d470-6e3b-4fcc-8c2b-d17428568a9f
  1169. set "_key=H62QG-HXVKF-PP4HP-66KMR-CW9BM"
  1170. goto :InstallKey
  1171. :: SharePoint Workspace 2010 (Groove)
  1172. :8947d0b8-c33b-43e1-8c56-9b674c052832
  1173. set "_key=QYYW6-QP4CB-MBV6G-HYMCJ-4T3J4"
  1174. goto :InstallKey
  1175. :: InfoPath 2010
  1176. :ca6b6639-4ad6-40ae-a575-14dee07f6430
  1177. set "_key=K96W8-67RPQ-62T9Y-J8FQJ-BT37T"
  1178. goto :InstallKey
  1179. :: OneNote 2010
  1180. :ab586f5c-5256-4632-962f-fefd8b49e6f4
  1181. set "_key=Q4Y4M-RHWJM-PY37F-MTKWH-D3XHX"
  1182. goto :InstallKey
  1183. :: Outlook 2010
  1184. :ecb7c192-73ab-4ded-acf4-2399b095d0cc
  1185. set "_key=7YDC2-CWM8M-RRTJC-8MDVC-X3DWQ"
  1186. goto :InstallKey
  1187. :: PowerPoint 2010
  1188. :45593b1d-dfb1-4e91-bbfb-2d5d0ce2227a
  1189. set "_key=RC8FX-88JRY-3PF7C-X8P67-P4VTT"
  1190. goto :InstallKey
  1191. :: Project 2010 Professional
  1192. :df133ff7-bf14-4f95-afe3-7b48e7e331ef
  1193. set "_key=YGX6F-PGV49-PGW3J-9BTGG-VHKC6"
  1194. goto :InstallKey
  1195. :: Project 2010 Standard
  1196. :5dc7bf61-5ec9-4996-9ccb-df806a2d0efe
  1197. set "_key=4HP3K-88W3F-W2K3D-6677X-F9PGB"
  1198. goto :InstallKey
  1199. :: Publisher 2010
  1200. :b50c4f75-599b-43e8-8dcd-1081a7967241
  1201. set "_key=BFK7F-9MYHM-V68C7-DRQ66-83YTP"
  1202. goto :InstallKey
  1203. :: Word 2010
  1204. :2d0882e7-a4e7-423b-8ccc-70d91e0158b1
  1205. set "_key=HVHB3-C6FV7-KQX9W-YQG79-CRY7T"
  1206. goto :InstallKey
  1207. :: Visio 2010 Premium
  1208. :92236105-bb67-494f-94c7-7f7a607929bd
  1209. set "_key=D9DWC-HPYVV-JGF4P-BTWQB-WX8BJ"
  1210. goto :InstallKey
  1211. :: Visio 2010 Professional
  1212. :e558389c-83c3-4b29-adfe-5e4d7f46c358
  1213. set "_key=7MCW8-VRQVK-G677T-PDJCM-Q8TCP"
  1214. goto :InstallKey
  1215. :: Visio 2010 Standard
  1216. :9ed833ff-4f92-4f36-b370-8683a4f13275
  1217. set "_key=767HD-QGMWX-8QTDB-9G3R2-KHFGJ"
  1218. goto :InstallKey
  1219. :: Office 2010 Home and Business
  1220. :ea509e87-07a1-4a45-9edc-eba5a39f36af
  1221. set "_key=D6QFG-VBYP2-XQHM7-J97RH-VVRCK"
  1222. goto :InstallKey
  1223. :: Office 2010 Mondo
  1224. :09ed9640-f020-400a-acd8-d7d867dfd9c2
  1225. set "_key=YBJTT-JG6MD-V9Q7P-DBKXJ-38W9R"
  1226. goto :InstallKey
  1227. :: Office 2010 Mondo
  1228. :ef3d4e49-a53d-4d81-a2b1-2ca6c2556b2c
  1229. set "_key=7TC2V-WXF6P-TD7RT-BQRXR-B8K32"
  1230. goto :InstallKey
  1231. ::==========================================
  1232. :: Windows 10 Home
  1233. :58e97c99-f377-4ef1-81d5-4ad5522b5fd8
  1234. set "_key=TX9XD-98N7V-6WMQ6-BX7FG-H8Q99"
  1235. goto :InstallKey
  1236. :: Windows 10 Home N
  1237. :7b9e1751-a8da-4f75-9560-5fadfe3d8e38
  1238. set "_key=3KHY7-WNT83-DGQKR-F7HPR-844BM"
  1239. goto :InstallKey
  1240. :: Windows 10 Home Single Language
  1241. :cd918a57-a41b-4c82-8dce-1a538e221a83
  1242. set "_key=7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH"
  1243. goto :InstallKey
  1244. :: Windows 10 Home Country Specific
  1245. :a9107544-f4a0-4053-a96a-1479abdef912
  1246. set "_key=PVMJN-6DFY6-9CCP6-7BKTT-D3WVR"
  1247. goto :InstallKey
  1248. :: Windows 10 Professional
  1249. :2de67392-b7a7-462a-b1ca-108dd189f588
  1250. set "_key=W269N-WFGWX-YVC9B-4J6C9-T83GX"
  1251. goto :InstallKey
  1252. :: Windows 10 Professional N
  1253. :a80b5abf-76ad-428b-b05d-a47d2dffeebf
  1254. set "_key=MH37W-N47XK-V7XM9-C7227-GCQG9"
  1255. goto :InstallKey
  1256. :: Windows 10 Professional Education
  1257. :3f1afc82-f8ac-4f6c-8005-1d233e606eee
  1258. set "_key=6TP4R-GNPTD-KYYHQ-7B7DP-J447Y"
  1259. goto :InstallKey
  1260. :: Windows 10 Professional Education N
  1261. :5300b18c-2e33-4dc2-8291-47ffcec746dd
  1262. set "_key=YVWGF-BXNMC-HTQYQ-CPQ99-66QFC"
  1263. goto :InstallKey
  1264. :: Windows 10 Professional Workstation
  1265. :82bbc092-bc50-4e16-8e18-b74fc486aec3
  1266. set "_key=NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J"
  1267. goto :InstallKey
  1268. :: Windows 10 Professional Workstation N
  1269. :4b1571d3-bafb-4b40-8087-a961be2caf65
  1270. set "_key=9FNHH-K3HBT-3W4TD-6383H-6XYWF"
  1271. goto :InstallKey
  1272. :: Windows 10 Education
  1273. :e0c42288-980c-4788-a014-c080d2e1926e
  1274. set "_key=NW6C2-QMPVW-D7KKK-3GKT6-VCFB2"
  1275. goto :InstallKey
  1276. :: Windows 10 Education N
  1277. :3c102355-d027-42c6-ad23-2e7ef8a02585
  1278. set "_key=2WH4N-8QGBV-H22JP-CT43Q-MDWWJ"
  1279. goto :InstallKey
  1280. :: Windows 10 Enterprise
  1281. :73111121-5638-40f6-bc11-f1d7b0d64300
  1282. set "_key=NPPR9-FWDCX-D2C8J-H872K-2YT43"
  1283. goto :InstallKey
  1284. :: Windows 10 Enterprise N
  1285. :e272e3e2-732f-4c65-a8f0-484747d0d947
  1286. set "_key=DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4"
  1287. goto :InstallKey
  1288. :: Windows 10 Enterprise G
  1289. :e0b2d383-d112-413f-8a80-97f373a5820c
  1290. set "_key=YYVX9-NTFWV-6MDM3-9PT4T-4M68B"
  1291. goto :InstallKey
  1292. :: Windows 10 Enterprise G N
  1293. :e38454fb-41a4-4f59-a5dc-25080e354730
  1294. set "_key=44RPN-FTY23-9VTTB-MP9BX-T84FV"
  1295. goto :InstallKey
  1296. :: Windows 10 Enterprise 2015 LTSB
  1297. :7b51a46c-0c04-4e8f-9af4-8496cca90d5e
  1298. set "_key=WNMTR-4C88C-JK8YV-HQ7T2-76DF9"
  1299. goto :InstallKey
  1300. :: Windows 10 Enterprise 2015 LTSB N
  1301. :87b838b7-41b6-4590-8318-5797951d8529
  1302. set "_key=2F77B-TNFGY-69QQF-B8YKP-D69TJ"
  1303. goto :InstallKey
  1304. :: Windows 10 Enterprise 2016 LTSB
  1305. :2d5a5a60-3040-48bf-beb0-fcd770c20ce0
  1306. set "_key=DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ"
  1307. goto :InstallKey
  1308. :: Windows 10 Enterprise 2016 LTSB N
  1309. :9f776d83-7156-45b2-8a5c-359b9c9f22a3
  1310. set "_key=QFFDN-GRT3P-VKWWX-X7T3R-8B639"
  1311. goto :InstallKey
  1312. :: Windows 10 Enterprise LTSC 2018
  1313. :32d2fab3-e4a8-42c2-923b-4bf4fd13e6ee
  1314. set "_key=M7XTQ-FN8P6-TTKYV-9D4CC-J462D"
  1315. goto :InstallKey
  1316. :: Windows 10 Enterprise LTSC 2018 N
  1317. :7103a333-b8c8-49cc-93ce-d37c09687f92
  1318. set "_key=92NFX-8DJQP-P6BBQ-THF9C-7CG2H"
  1319. goto :InstallKey
  1320. :: Windows 10 Enterprise Remote Server
  1321. :e4db50ea-bda1-4566-b047-0ca50abc6f07
  1322. set "_key=7NBT4-WGBQX-MP4H7-QXFF8-YP3KX"
  1323. goto :InstallKey
  1324. :: Windows 10 Enterprise for Remote Sessions
  1325. :ec868e65-fadf-4759-b23e-93fe37f2cc29
  1326. set "_key=CPWHC-NT2C7-VYW78-DHDB2-PG3GK"
  1327. goto :InstallKey
  1328. :: Windows 10 Lean
  1329. :0df4f814-3f57-4b8b-9a9d-fddadcd69fac
  1330. set "_key=NBTWJ-3DR69-3C4V8-C26MC-GQ9M6"
  1331. goto :InstallKey
  1332. ::==========================================
  1333. :: Windows Server 2019 Essentials
  1334. :034d3cbb-5d4b-4245-b3f8-f84571314078
  1335. set "_key=WVDHN-86M7X-466P6-VHXV7-YY726"
  1336. goto :InstallKey
  1337. :: Windows Server 2019 Standard
  1338. :de32eafd-aaee-4662-9444-c1befb41bde2
  1339. set "_key=N69G4-B89J2-4G8F4-WWYCC-J464C"
  1340. goto :InstallKey
  1341. :: Windows Server 2019 Datacenter
  1342. :34e1ae55-27f8-4950-8877-7a03be5fb181
  1343. set "_key=WMDGN-G9PQG-XVVXX-R3X43-63DFG"
  1344. goto :InstallKey
  1345. :: Windows Server 2019 Standard ACor
  1346. :73e3957c-fc0c-400d-9184-5f7b6f2eb409
  1347. set "_key=N2KJX-J94YW-TQVFB-DG9YT-724CC"
  1348. goto :InstallKey
  1349. :: Windows Server 2019 Datacenter ACor
  1350. :90c362e5-0da1-4bfd-b53b-b87d309ade43
  1351. set "_key=6NMRW-2C8FM-D24W7-TQWMY-CWH2D"
  1352. goto :InstallKey
  1353. :: Windows Server 2019 Azure Core
  1354. :a99cc1f0-7719-4306-9645-294102fbff95
  1355. set "_key=FDNH6-VW9RW-BXPJ7-4XTYG-239TB"
  1356. goto :InstallKey
  1357. :: Windows Server 2019 ARM64
  1358. :8de8eb62-bbe0-40ac-ac17-f75595071ea3
  1359. set "_key=GRFBW-QNDC4-6QBHG-CCK3B-2PR88"
  1360. goto :InstallKey
  1361. ::==========================================
  1362. :: Windows Server 2016 Essentials
  1363. :2b5a1b0f-a5ab-4c54-ac2f-a6d94824a283
  1364. set "_key=JCKRF-N37P4-C2D82-9YXRT-4M63B"
  1365. goto :InstallKey
  1366. :: Windows Server 2016 Standard
  1367. :8c1c5410-9f39-4805-8c9d-63a07706358f
  1368. set "_key=WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY"
  1369. goto :InstallKey
  1370. :: Windows Server 2016 Datacenter
  1371. :21c56779-b449-4d20-adfc-eece0e1ad74b
  1372. set "_key=CB7KF-BWN84-R7R2Y-793K2-8XDDG"
  1373. goto :InstallKey
  1374. :: Windows Server 2016 Standard ACor
  1375. :61c5ef22-f14f-4553-a824-c4b31e84b100
  1376. set "_key=PTXN8-JFHJM-4WC78-MPCBR-9W4KR"
  1377. goto :InstallKey
  1378. :: Windows Server 2016 Datacenter ACor
  1379. :e49c08e7-da82-42f8-bde2-b570fbcae76c
  1380. set "_key=2HXDN-KRXHB-GPYC7-YCKFJ-7FVDG"
  1381. goto :InstallKey
  1382. :: Windows Server 2016 Cloud Storage
  1383. :7b4433f4-b1e7-4788-895a-c45378d38253
  1384. set "_key=QN4C6-GBJD2-FB422-GHWJK-GJG2R"
  1385. goto :InstallKey
  1386. :: Windows Server 2016 Azure Core
  1387. :3dbf341b-5f6c-4fa7-b936-699dce9e263f
  1388. set "_key=VP34G-4NPPG-79JTQ-864T4-R3MQX"
  1389. goto :InstallKey
  1390. :: Windows Server 2016 ARM64
  1391. :43d9af6e-5e86-4be8-a797-d072a046896c
  1392. set "_key=K9FYF-G6NCK-73M32-XMVPY-F9DRR"
  1393. goto :InstallKey
  1394. ::==========================================
  1395. :: Windows 8.1 Professional
  1396. :c06b6981-d7fd-4a35-b7b4-054742b7af67
  1397. set "_key=GCRJD-8NW9H-F2CDX-CCM8D-9D6T9"
  1398. goto :InstallKey
  1399. :: Windows 8.1 Professional N
  1400. :7476d79f-8e48-49b4-ab63-4d0b813a16e4
  1401. set "_key=HMCNV-VVBFX-7HMBH-CTY9B-B4FXY"
  1402. goto :InstallKey
  1403. :: Windows 8.1 Enterprise
  1404. :81671aaf-79d1-4eb1-b004-8cbbe173afea
  1405. set "_key=MHF9N-XY6XB-WVXMC-BTDCT-MKKG7"
  1406. goto :InstallKey
  1407. :: Windows 8.1 Enterprise N
  1408. :113e705c-fa49-48a4-beea-7dd879b46b14
  1409. set "_key=TT4HM-HN7YT-62K67-RGRQJ-JFFXW"
  1410. goto :InstallKey
  1411. :: Windows 8.1 Professional WMC
  1412. :096ce63d-4fac-48a9-82a9-61ae9e800e5f
  1413. set "_key=789NJ-TQK6T-6XTH8-J39CJ-J8D3P"
  1414. goto :InstallKey
  1415. :: Windows 8.1 Core
  1416. :fe1c3238-432a-43a1-8e25-97e7d1ef10f3
  1417. set "_key=M9Q9P-WNJJT-6PXPY-DWX8H-6XWKK"
  1418. goto :InstallKey
  1419. :: Windows 8.1 Core N
  1420. :78558a64-dc19-43fe-a0d0-8075b2a370a3
  1421. set "_key=7B9N3-D94CG-YTVHR-QBPX3-RJP64"
  1422. goto :InstallKey
  1423. :: Windows 8.1 Core ARM
  1424. :ffee456a-cd87-4390-8e07-16146c672fd0
  1425. set "_key=XYTND-K6QKT-K2MRH-66RTM-43JKP"
  1426. goto :InstallKey
  1427. :: Windows 8.1 Core Single Language
  1428. :c72c6a1d-f252-4e7e-bdd1-3fca342acb35
  1429. set "_key=BB6NG-PQ82V-VRDPW-8XVD2-V8P66"
  1430. goto :InstallKey
  1431. :: Windows 8.1 Core Country Specific
  1432. :db78b74f-ef1c-4892-abfe-1e66b8231df6
  1433. set "_key=NCTT7-2RGK8-WMHRF-RY7YQ-JTXG3"
  1434. goto :InstallKey
  1435. :: Windows 8.1 Embedded Industry
  1436. :0ab82d54-47f4-4acb-818c-cc5bf0ecb649
  1437. set "_key=NMMPB-38DD4-R2823-62W8D-VXKJB"
  1438. goto :InstallKey
  1439. :: Windows 8.1 Embedded Industry Enterprise
  1440. :cd4e2d9f-5059-4a50-a92d-05d5bb1267c7
  1441. set "_key=FNFKF-PWTVT-9RC8H-32HB2-JB34X"
  1442. goto :InstallKey
  1443. :: Windows 8.1 Embedded Industry Automotive
  1444. :f7e88590-dfc7-4c78-bccb-6f3865b99d1a
  1445. set "_key=VHXM3-NR6FT-RY6RT-CK882-KW2CJ"
  1446. goto :InstallKey
  1447. :: Windows 8.1 Core Connected (with Bing)
  1448. :e9942b32-2e55-4197-b0bd-5ff58cba8860
  1449. set "_key=3PY8R-QHNP9-W7XQD-G6DPH-3J2C9"
  1450. goto :InstallKey
  1451. :: Windows 8.1 Core Connected N (with Bing)
  1452. :c6ddecd6-2354-4c19-909b-306a3058484e
  1453. set "_key=Q6HTR-N24GM-PMJFP-69CD8-2GXKR"
  1454. goto :InstallKey
  1455. :: Windows 8.1 Core Connected Single Language (with Bing)
  1456. :b8f5e3a3-ed33-4608-81e1-37d6c9dcfd9c
  1457. set "_key=KF37N-VDV38-GRRTV-XH8X6-6F3BB"
  1458. goto :InstallKey
  1459. :: Windows 8.1 Core Connected Country Specific (with Bing)
  1460. :ba998212-460a-44db-bfb5-71bf09d1c68b
  1461. set "_key=R962J-37N87-9VVK2-WJ74P-XTMHR"
  1462. goto :InstallKey
  1463. :: Windows 8.1 Professional Student
  1464. :e58d87b5-8126-4580-80fb-861b22f79296
  1465. set "_key=MX3RK-9HNGX-K3QKC-6PJ3F-W8D7B"
  1466. goto :InstallKey
  1467. :: Windows 8.1 Professional Student N
  1468. :cab491c7-a918-4f60-b502-dab75e334f40
  1469. set "_key=TNFGH-2R6PB-8XM3K-QYHX2-J4296"
  1470. goto :InstallKey
  1471. ::==========================================
  1472. :: Windows Server 2012 R2 Standard
  1473. :b3ca044e-a358-4d68-9883-aaa2941aca99
  1474. set "_key=D2N9P-3P6X9-2R39C-7RTCD-MDVJX"
  1475. goto :InstallKey
  1476. :: Windows Server 2012 R2 Datacenter
  1477. :00091344-1ea4-4f37-b789-01750ba6988c
  1478. set "_key=W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9"
  1479. goto :InstallKey
  1480. :: Windows Server 2012 R2 Essentials
  1481. :21db6ba4-9a7b-4a14-9e29-64a60c59301d
  1482. set "_key=KNC87-3J2TX-XB4WP-VCPJV-M4FWM"
  1483. goto :InstallKey
  1484. :: Windows Server 2012 R2 Cloud Storage
  1485. :b743a2be-68d4-4dd3-af32-92425b7bb623
  1486. set "_key=3NPTF-33KPT-GGBPR-YX76B-39KDD"
  1487. goto :InstallKey
  1488. ::==========================================
  1489. :: Windows 8 Professional
  1490. :a98bcd6d-5343-4603-8afe-5908e4611112
  1491. set "_key=NG4HW-VH26C-733KW-K6F98-J8CK4"
  1492. goto :InstallKey
  1493. :: Windows 8 Professional N
  1494. :ebf245c1-29a8-4daf-9cb1-38dfc608a8c8
  1495. set "_key=XCVCF-2NXM9-723PB-MHCB7-2RYQQ"
  1496. goto :InstallKey
  1497. :: Windows 8 Enterprise
  1498. :458e1bec-837a-45f6-b9d5-925ed5d299de
  1499. set "_key=32JNW-9KQ84-P47T8-D8GGY-CWCK7"
  1500. goto :InstallKey
  1501. :: Windows 8 Enterprise N
  1502. :e14997e7-800a-4cf7-ad10-de4b45b578db
  1503. set "_key=JMNMF-RHW7P-DMY6X-RF3DR-X2BQT"
  1504. goto :InstallKey
  1505. :: Windows 8 Professional WMC
  1506. :a00018a3-f20f-4632-bf7c-8daa5351c914
  1507. set "_key=GNBB8-YVD74-QJHX6-27H4K-8QHDG"
  1508. goto :InstallKey
  1509. :: Windows 8 Core
  1510. :c04ed6bf-55c8-4b47-9f8e-5a1f31ceee60
  1511. set "_key=BN3D2-R7TKB-3YPBD-8DRP2-27GG4"
  1512. goto :InstallKey
  1513. :: Windows 8 Core N
  1514. :197390a0-65f6-4a95-bdc4-55d58a3b0253
  1515. set "_key=8N2M2-HWPGY-7PGT9-HGDD8-GVGGY"
  1516. goto :InstallKey
  1517. :: Windows 8 Core Single Language
  1518. :8860fcd4-a77b-4a20-9045-a150ff11d609
  1519. set "_key=2WN2H-YGCQR-KFX6K-CD6TF-84YXQ"
  1520. goto :InstallKey
  1521. :: Windows 8 Core Country Specific
  1522. :9d5584a2-2d85-419a-982c-a00888bb9ddf
  1523. set "_key=4K36P-JN4VD-GDC6V-KDT89-DYFKP"
  1524. goto :InstallKey
  1525. :: Windows 8 Core ARM
  1526. :af35d7b7-5035-4b63-8972-f0b747b9f4dc
  1527. set "_key=DXHJF-N9KQX-MFPVR-GHGQK-Y7RKV"
  1528. goto :InstallKey
  1529. :: Windows 8 Embedded Industry Professional
  1530. :10018baf-ce21-4060-80bd-47fe74ed4dab
  1531. set "_key=RYXVT-BNQG7-VD29F-DBMRY-HT73M"
  1532. goto :InstallKey
  1533. :: Windows 8 Embedded Industry Enterprise
  1534. :18db1848-12e0-4167-b9d7-da7fcda507db
  1535. set "_key=NKB3R-R2F8T-3XCDP-7Q2KW-XWYQ2"
  1536. goto :InstallKey
  1537. ::==========================================
  1538. :: Windows Server 2012 Standard
  1539. :f0f5ec41-0d55-4732-af02-440a44a3cf0f
  1540. set "_key=XC9B7-NBPP2-83J2H-RHMBY-92BT4"
  1541. goto :InstallKey
  1542. :: Windows Server 2012 Datacenter
  1543. :d3643d60-0c42-412d-a7d6-52e6635327f6
  1544. set "_key=48HP8-DN98B-MYWDG-T2DCC-8W83P"
  1545. goto :InstallKey
  1546. :: Windows Server 2012 MultiPoint Standard
  1547. :7d5486c7-e120-4771-b7f1-7b56c6d3170c
  1548. set "_key=HM7DN-YVMH3-46JC3-XYTG7-CYQJJ"
  1549. goto :InstallKey
  1550. :: Windows Server 2012 MultiPoint Premium
  1551. :95fd1c83-7df5-494a-be8b-1300e1c9d1cd
  1552. set "_key=XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G"
  1553. goto :InstallKey
  1554. ::==========================================
  1555. :: Windows 7 Professional
  1556. :b92e9980-b9d5-4821-9c94-140f632f6312
  1557. set "_key=FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4"
  1558. goto :InstallKey
  1559. :: Windows 7 Professional N
  1560. :54a09a0d-d57b-4c10-8b69-a842d6590ad5
  1561. set "_key=MRPKT-YTG23-K7D7T-X2JMM-QY7MG"
  1562. goto :InstallKey
  1563. :: Windows 7 Professional E
  1564. :5a041529-fef8-4d07-b06f-b59b573b32d2
  1565. set "_key=W82YF-2Q76Y-63HXB-FGJG9-GF7QX"
  1566. goto :InstallKey
  1567. :: Windows 7 Enterprise
  1568. :ae2ee509-1b34-41c0-acb7-6d4650168915
  1569. set "_key=33PXH-7Y6KF-2VJC9-XBBR8-HVTHH"
  1570. goto :InstallKey
  1571. :: Windows 7 Enterprise N
  1572. :1cb6d605-11b3-4e14-bb30-da91c8e3983a
  1573. set "_key=YDRBP-3D83W-TY26F-D46B2-XCKRJ"
  1574. goto :InstallKey
  1575. :: Windows 7 Enterprise E
  1576. :46bbed08-9c7b-48fc-a614-95250573f4ea
  1577. set "_key=C29WB-22CC8-VJ326-GHFJW-H9DH4"
  1578. goto :InstallKey
  1579. :: Windows 7 Embedded POS Ready
  1580. :db537896-376f-48ae-a492-53d0547773d0
  1581. set "_key=YBYF6-BHCR3-JPKRB-CDW7B-F9BK4"
  1582. goto :InstallKey
  1583. :: Windows 7 Embedded ThinPC
  1584. :aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395
  1585. set "_key=73KQT-CD9G6-K7TQG-66MRP-CQ22C"
  1586. goto :InstallKey
  1587. :: Windows 7 Embedded Standard
  1588. :e1a8296a-db37-44d1-8cce-7bc961d59c54
  1589. set "_key=XGY72-BRBBT-FF8MH-2GG8H-W7KCW"
  1590. goto :InstallKey
  1591. ::==========================================
  1592. :: Windows Server 2008 R2 Web
  1593. :a78b8bd9-8017-4df5-b86a-09f756affa7c
  1594. set "_key=6TPJF-RBVHG-WBW2R-86QPH-6RTM4"
  1595. goto :InstallKey
  1596. :: Windows Server 2008 R2 HPC edition
  1597. :cda18cf3-c196-46ad-b289-60c072869994
  1598. set "_key=TT8MH-CG224-D3D7Q-498W2-9QCTX"
  1599. goto :InstallKey
  1600. :: Windows Server 2008 R2 Standard
  1601. :68531fb9-5511-4989-97be-d11a0f55633f
  1602. set "_key=YC6KT-GKW9T-YTKYR-T4X34-R7VHC"
  1603. goto :InstallKey
  1604. :: Windows Server 2008 R2 Enterprise
  1605. :620e2b3d-09e7-42fd-802a-17a13652fe7a
  1606. set "_key=489J6-VHDMP-X63PK-3K798-CPX3Y"
  1607. goto :InstallKey
  1608. :: Windows Server 2008 R2 Datacenter
  1609. :7482e61b-c589-4b7f-8ecc-46d455ac3b87
  1610. set "_key=74YFP-3QFB3-KQT8W-PMXWJ-7M648"
  1611. goto :InstallKey
  1612. :: Windows Server 2008 R2 for Itanium-based Systems
  1613. :8a26851c-1c7e-48d3-a687-fbca9b9ac16b
  1614. set "_key=GT63C-RJFQ3-4GMB6-BRFB9-CB83V"
  1615. goto :InstallKey
  1616. :: Windows MultiPoint Server 2010
  1617. :f772515c-0e87-48d5-a676-e6962c3e1195
  1618. set "_key=736RG-XDKJK-V34PF-BHK87-J6X3K"
  1619. goto :InstallKey
  1620. ::==========================================
  1621. :: Windows Vista Business
  1622. :4f3d1606-3fea-4c01-be3c-8d671c401e3b
  1623. set "_key=YFKBB-PQJJV-G996G-VWGXY-2V3X8"
  1624. goto :InstallKey
  1625. :: Windows Vista Business N
  1626. :2c682dc2-8b68-4f63-a165-ae291d4cf138
  1627. set "_key=HMBQG-8H2RH-C77VX-27R82-VMQBT"
  1628. goto :InstallKey
  1629. :: Windows Vista Enterprise
  1630. :cfd8ff08-c0d7-452b-9f60-ef5c70c32094
  1631. set "_key=VKK3X-68KWM-X2YGT-QR4M6-4BWMV"
  1632. goto :InstallKey
  1633. :: Windows Vista Enterprise N
  1634. :d4f54950-26f2-4fb4-ba21-ffab16afcade
  1635. set "_key=VTC42-BM838-43QHV-84HX6-XJXKV"
  1636. goto :InstallKey
  1637. ::==========================================
  1638. :: Windows Server 2008 Web
  1639. :ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b
  1640. set "_key=WYR28-R7TFJ-3X2YQ-YCY4H-M249D"
  1641. goto :InstallKey
  1642. :: Windows Server 2008 Standard
  1643. :ad2542d4-9154-4c6d-8a44-30f11ee96989
  1644. set "_key=TM24T-X9RMF-VWXK6-X8JC9-BFGM2"
  1645. goto :InstallKey
  1646. :: Windows Server 2008 Standard without Hyper-V
  1647. :2401e3d0-c50a-4b58-87b2-7e794b7d2607
  1648. set "_key=W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ"
  1649. goto :InstallKey
  1650. :: Windows Server 2008 Enterprise
  1651. :c1af4d90-d1bc-44ca-85d4-003ba33db3b9
  1652. set "_key=YQGMW-MPWTJ-34KDK-48M3W-X4Q6V"
  1653. goto :InstallKey
  1654. :: Windows Server 2008 Enterprise without Hyper-V
  1655. :8198490a-add0-47b2-b3ba-316b12d647b4
  1656. set "_key=39BXF-X8Q23-P2WWT-38T2F-G3FPG"
  1657. goto :InstallKey
  1658. :: Windows Server 2008 HPC (Compute Cluster)
  1659. :7afb1156-2c1d-40fc-b260-aab7442b62fe
  1660. set "_key=RCTX3-KWVHP-BR6TB-RB6DM-6X7HP"
  1661. goto :InstallKey
  1662. :: Windows Server 2008 Datacenter
  1663. :68b6e220-cf09-466b-92d3-45cd964b9509
  1664. set "_key=7M67G-PC374-GR742-YH8V4-TCBY3"
  1665. goto :InstallKey
  1666. :: Windows Server 2008 Datacenter without Hyper-V
  1667. :fd09ef77-5647-4eff-809c-af2b64659a45
  1668. set "_key=22XQ2-VRXRG-P8D42-K34TD-G3QQC"
  1669. goto :InstallKey
  1670. :: Windows Server 2008 for Itanium-Based Systems
  1671. :01ef176b-3e0d-422a-b4f8-4ea880035e8f
  1672. set "_key=4DWFP-JF3DJ-B7DTH-78FJB-PDRHK"
  1673. goto :InstallKey
  1674. ::==========================================
  1675. :KeyNotFound
  1676. :: If GVLK is not found for the current SKU-ID, attempt Activation as GVLK might be present in OS by default
  1677. echo.
  1678. echo GVLK for %_Name%
  1679. echo with SKU-ID %1 Not Found
  1680. echo.
  1681. echo If Activation Fails Now, Please enter GVLK for this Product manually and re-run KMS-VL-ALL.cmd
  1682. call :Activate %1
  1683. exit /b
  1684. ::==========================================
  1685. :InstallKey
  1686. :: Call InstallProductKey method of SLS/OSPS to install GVLK
  1687. echo Installing Key...
  1688. wmic path %_MicrosoftService% where version='%_Version%' call InstallProductKey ProductKey="%_key%" %_Nul_1_2%
  1689. call :Activate %1
  1690. exit /b
  1691. ::==========================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement