diff --git a/.gitattributes b/.gitattributes index de5bd3d..8749e12 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -MAS export-ignore -LICENSE export-ignore -README.md export-ignore +# MAS export-ignore +# LICENSE export-ignore +# README.md export-ignore .gitattributes export-ignore diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 73ac408..20a5790 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1,5 +1,5 @@ -@::de62hd8-random -@set masver=3.1 +@::yfh37fow-random +@set masver=3.4 @setlocal DisableDelayedExpansion @echo off @@ -67,6 +67,8 @@ exit /b set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -153,15 +155,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto dk_done ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto dk_done ) @@ -217,12 +219,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -252,7 +256,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -334,7 +344,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -386,7 +396,16 @@ if not defined terminal mode 76, 34 if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _hwidgo=1 if %winbuild% GTR 14393 if exist "%SysPath%\spp\tokens\skus\EnterpriseSN\" set _hwidgo= if not defined _hwidgo set _tsforgego=1 + set _ohookgo=1 +if %winbuild% GEQ 9200 ( +if %winbuild% LSS 10240 set _ohookgo= +if %winbuild% GEQ 19041 if %winbuild% LEQ 19045 set _ohookgo= +if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set _ohookgo= +if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _ohookgo= +if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-EnterpriseS*dition~*.mum" set _ohookgo= +) +if not defined _ohookgo set _tsforgego=1 echo: echo: @@ -431,7 +450,7 @@ choice /C:123456789EH0 /N set _erl=%errorlevel% if %_erl%==12 exit /b -if %_erl%==11 start %mas%troubleshoot & goto :MainMenu +if %_erl%==11 (start %selfgit% & start %github% & start %mas%troubleshoot & goto :MainMenu) if %_erl%==10 goto :Extras if %_erl%==9 setlocal & call :troubleshoot & cls & endlocal & goto :MainMenu if %_erl%==8 setlocal & call :change_offedition & cls & endlocal & goto :MainMenu @@ -662,11 +681,13 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) ) @@ -1284,9 +1305,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( set len=0 -echo:!allapps!> %SystemRoot%\Temp\chklen -for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) -del %SystemRoot%\Temp\chklen %nul% +echo:!allapps!> "!_ttemp!\chklen" +for %%A in ("!_ttemp!\chklen") do (set len=%%~zA) +del "!_ttemp!\chklen" %nul% if !len! GTR 6000 ( %eline% @@ -1400,7 +1421,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1466,7 +1487,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -1605,7 +1626,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -1676,10 +1697,12 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) if %_wmic% EQU 1 wmic path %sps% get Version %nul% @@ -1874,7 +1897,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -1999,7 +2022,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( @@ -2164,32 +2188,6 @@ for %%A in (%_act% %_rem%) do (if "%%A"=="1" set _unattended=1) ::======================================================================================================================================== -if %winbuild% LSS 6001 ( -%nceline% -echo Unsupported OS version detected [%winbuild%]. -echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. -if %winbuild% EQU 6000 ( -echo: -echo Windows Vista RTM is not supported because Powershell cannot be installed. -echo Upgrade to Windows Vista SP1 or SP2. -) -goto dk_done -) - -if not exist %ps% ( -%nceline% -echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. -echo: -echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) -goto dk_done -) - -::======================================================================================================================================== - if %_rem%==1 goto :oh_uninstall :oh_menu @@ -2246,11 +2244,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -2294,8 +2294,8 @@ set o16uwp= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) %nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R @@ -2348,7 +2348,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You only have the Office dashboard app installed, you need to install the full version of Office. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) echo: call :dk_color %Blue% "Download and install Office from the below URL and then try again." @@ -2423,6 +2423,7 @@ set error=1 goto :starto16c2r ) +call :oh_expiredpreview 2013 call :oh_fixprids call :oh_process if defined isOspp ( @@ -2480,6 +2481,7 @@ set error=1 goto :startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 call :oh_fixprids call :oh_process if defined isOspp ( @@ -2490,12 +2492,12 @@ call :oh_hookinstall ::======================================================================================================================================== -:: Old version (16.0.9xxxx and below) of Office with subscription license key may show a banner to sign in to fix license issue. +:: Old version of Office with subscription license key may show a banner to sign in to fix license issue. :: Although script applies a Resiliency registry entry to fix that but it doesn't work on old office versions. :: Below code checks that condition and informs the user to update the Office. if defined _sublic ( -if not exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( +if not exist "%_oLPath%\Word2021VL_KMS_Client_AE*.xrm-ms" ( call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Office, otherwise, it may show a licensing issue-related banner.]" ) ) @@ -2728,12 +2730,27 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" % for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) + +exit /b + +::======================================================================================================================================== + +:oh_expiredpreview + +for %%# in (%*) do ( +if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" ( +set error=1 +set showfix=1 +call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]" +call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again." +) +) exit /b @@ -3175,7 +3192,7 @@ exit /b :oh_clearblock :: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing -:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state +:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state set _sidlist= for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a)) @@ -3271,12 +3288,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share ) :: Clear device-based-licensing -:: https://learn.microsoft.com/deployoffice/device-based-licensing +:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul% :: Remove OEM registry key -:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 +:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 for %%# in (15 16) do ( reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul% @@ -3420,7 +3437,6 @@ exit /b 14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR 14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR 14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR] -14_98677603-a668-4fa4-9980-3f1f05f78f69_Retail________PublisherR 14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR] 14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR] @@ -3458,6 +3474,7 @@ for %%# in ( 14_11b39439-6b93-4642-9570-f2eb81be2238_4DTT4-D4MKX-23KFH-JKR6T-YK%f%G2J_MAK___________ProjectStdVL 14_71af7e84-93e6-4363-9b69-699e04e74071_2J9H6-H4D3G-PCXD2-96XVM-TR%f%R73_Retail________ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] 14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_6CD6C-9R8PB-T2D9Y-8RKKX-W7%f%DFK_MAK___________ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_CTRJP-P72VV-JBF8Y-4W6WW-HX%f%HVG_Retail________PublisherR 14_3d014759-b128-4466-9018-e80f6320d9d0_32YG9-3VX77-YXJVV-PRVFW-TT%f%8BV_MAK___________PublisherVL 14_8090771e-d41a-4482-929e-de87f1f47e46_7VKXH-9BWCG-RPTBB-JBRV3-GR%f%HYC_MAK___________SmallBusBasicsVL 14_b78df69e-0966-40b1-ae85-30a5134dedd0_H48K6-FB4Y6-P83GH-9J7XG-HD%f%KKX_ByPass________SPDR @@ -3522,6 +3539,7 @@ for %%# in ( 15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail 15_0bc1dae4-6158-4a1c-a893-807665b934b2_2QCNB-RMDKJ-GC8PB-7QGQV-7Q%f%TQJ_Subscription2_O365SmallBusPremRetail :: Office 365 - 16.0 version +16_dabaa1f2-109b-496d-bf49-1536cc862900_3HYJN-9KG99-F8VG9-V3DT8-JF%f%MHV_Subscription__O365AppsBasicRetail 16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail 16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W62NQ-267QR-RTF74-PF2MH-JQ%f%MTH_Subscription__O365EduCloudRetail 16_a96f8dae-da54-4fad-bdc6-108da592707a_3NMDC-G7C3W-68RGP-CB4MH-4C%f%XCH_SubTest1______O365HomePremRetail @@ -3975,6 +3993,11 @@ set tsids= :: To reset rearm counter, evaluation period and clear the tamper state, key lock, run the script with "/Z-Reset" parameter or change 0 to 1 in below line set _resall=0 +:: Choose activation method: +:: In builds 19041 and later, the script will auto select StaticCID (requires internet). If no internet is detected, it will then auto select the KMS4k method. For builds lower than 19041, the script will auto select ZeroCID. +:: To change the activation method, run the script with the parameters "/Z-SCID", "/Z-ZCID", or "/Z-KMS4k", or modify the option from Auto to SCID, ZCID, or KMS4k in the line below. +set _actmethod=Auto + :: Debug Mode: :: To run the script in debug mode, change 0 to any parameter above that you want to run, in below line set "_debug=0" @@ -4009,10 +4032,14 @@ if /i "%%A"=="/Z-OffHost" (set _actoffhost=1) if /i "%%A"=="/Z-APPX" (set _actappx=1) echo "%%A" | find /i "/Z-ID-" >nul && (set _actman=1& set "filtsids=%%A" & call set "filtsids=%%filtsids:~6%%" & if defined filtsids call set tsids=%%filtsids%% %%tsids%%) if /i "%%A"=="/Z-Reset" (set _resall=1) +if /i "%%A"=="/Z-SCID" (set _actmethod=SCID) +if /i "%%A"=="/Z-ZCID" (set _actmethod=ZCID) +if /i "%%A"=="/Z-KMS4k" (set _actmethod=KMS4k) ) if not defined tsids set _actman=0 for %%A in (%_actwin% %_actesu% %_actoff% %_actprojvis% %_actwinesuoff% %_actwinhost% %_actoffhost% %_actappx% %_actman% %_resall%) do (if "%%A"=="1" set _unattended=1) +if /i not %_actmethod%==Auto set _unattended=1 if %winbuild% LSS 7600 ( reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul2% | find /i "0x1" %nul1% || ( @@ -4020,8 +4047,8 @@ reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul echo .NET 3.5 Framework is not installed in your system. echo Install it using the following URL. echo: -echo https://www.microsoft.com/download/details.aspx?id=25150 -if %_unattended%==0 start https://www.microsoft.com/download/details.aspx?id=25150 +echo https://www.microsoft.com/en-us/download/details.aspx?id=25150 +if %_unattended%==0 start https://www.microsoft.com/en-us/download/details.aspx?id=25150 goto dk_done ) ) @@ -4058,6 +4085,7 @@ echo [E] Reset - Rearm/Timers ) else ( echo [E] Reset - Rearm/Timers/Tamper/Lock ) +echo [F] Change - Activation Method [%_actmethod%] echo _______________________________________________ echo: echo [6] Remove TSforge Activation @@ -4066,12 +4094,13 @@ echo [0] %_exitmsg% echo ______________________________________________________________ echo: call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard..." -choice /C:12345ABCDE670 /N +choice /C:12345ABCDEF670 /N set _el=!errorlevel! -if !_el!==13 exit /b -if !_el!==12 start %mas%genuine-installation-media & goto :ts_menu -if !_el!==11 call :ts_remove & cls & goto :ts_menu +if !_el!==14 exit /b +if !_el!==13 start %mas%genuine-installation-media & goto :ts_menu +if !_el!==12 call :ts_remove & cls & goto :ts_menu +if !_el!==11 goto :ts_changemethod if !_el!==10 cls & setlocal & set "_resall=1" & call :ts_start & endlocal & cls & goto :ts_menu if !_el!==9 cls & setlocal & set "_actman=1" & call :ts_start & endlocal & cls & goto :ts_menu if !_el!==8 cls & setlocal & set "_actappx=1" & call :ts_start & endlocal & cls & goto :ts_menu @@ -4085,6 +4114,57 @@ if !_el!==1 cls & setlocal & set "_actwin=1" & call :ts_start & endlocal goto :ts_menu ) +goto :ts_start + +::======================================================================================================================================== + +:ts_changemethod + +cls +if not defined terminal mode 76, 36 + +echo: +echo: +echo: +echo ______________________________________________________________ +echo: +call :dk_color2 %_White% " [1] " %_Green% "Auto" +echo Builds ^>= 19041 - StaticCID (KMS4k if offline) +echo Builds ^< 19041 - ZeroCID +echo __________________________________________________ +echo: +echo [2] StaticCID +echo Needs Internet +echo Not for Windows 7 or older +echo __________________________________________________ +echo: +echo [3] ZeroCID +echo Works reliably on builds below 19041 +echo May break on builds between 19041-26100 +echo Does not work on builds above 26100.4188 +echo __________________________________________________ +echo: +echo [4] KMS4k +echo Volume licenses only +echo Activates for 4000+ years +echo __________________________________________________ +echo: +echo [5] Learn More +echo [0] %_exitmsg% +echo ______________________________________________________________ +echo: +call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard..." +choice /C:123450 /N +set _el=!errorlevel! + +if !_el!==6 goto :ts_menu +if !_el!==5 cls & start %mas%tsforge &goto :ts_menu +if !_el!==4 cls & set "_actmethod=KMS4k" & goto :ts_menu +if !_el!==3 cls & set "_actmethod=ZCID" & goto :ts_menu +if !_el!==2 cls & set "_actmethod=SCID" & goto :ts_menu +if !_el!==1 cls & set "_actmethod=Auto" & goto :ts_menu +goto :ts_changemethod + ::======================================================================================================================================== :ts_start @@ -4107,11 +4187,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -4165,6 +4247,57 @@ cls echo: call :dk_showosinfo +if /i %_actmethod%==SCID set tsmethod=StaticCID +if /i %_actmethod%==ZCID set tsmethod=ZeroCID +if /i %_actmethod%==KMS4k set tsmethod=KMS4k + +if /i %_actmethod%==Auto ( +if %winbuild% GEQ 19041 ( +set tsmethod=StaticCID +) else ( +set tsmethod=ZeroCID +) +) + +if %winbuild% LSS 9200 if /i %tsmethod%==StaticCID ( +%eline% +echo StaticCID method is supported only on Windows 8 and later. +goto dk_done +) + +::======================================================================================================================================== + +:: Check Internet connection + +if /i %tsmethod%==StaticCID ( +set _int= +for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int ( +for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not "%%#"=="" set _int=1) +) + +if not defined _int ( +%psc% "If([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet){Exit 0}Else{Exit 1}" +if !errorlevel!==0 (set _int=1&set ping_f= But Ping Failed) +) + +if defined _int ( +echo Checking Internet Connection [Connected!ping_f!] +) else ( +if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k +if /i !tsmethod!==KMS4k ( +call :dk_color %Gray% "Checking Internet Connection [Not Connected]" +call :dk_color %Blue% "Switching To KMS4k Activation Method because Internet is needed for StaticCID method." +) else ( +set error=1 +call :dk_color %Red% "Checking Internet Connection [Not Connected]" +call :dk_color %Blue% "Internet is required for TSforge StaticCID option." +) +echo: +) +) + +::======================================================================================================================================== + echo Initiating Diagnostic Tests... set "_serv=%_slser% Winmgmt" @@ -4182,6 +4315,11 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto :dk_done ) +if /i !tsmethod!==KMS4k ( +call :_taskclear-cache +echo Clearing %KS% Cache [Successful] +) + ::======================================================================================================================================== if %_resall%==1 goto :ts_resetall @@ -4203,16 +4341,23 @@ echo %tsedition% | find /i "Eval" %nul1% && ( goto :ts_wineval ) -call :ts_checkwinperm +set /a UBR=0 +if %winbuild% EQU 26100 ( +for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b +if !UBR! LSS 4188 (set dontcheckact=1) +) + +if not defined dontcheckact call :ts_checkwinperm if defined _perm ( call :dk_color %Gray% "Checking OS Activation [Windows is already permanently activated]" goto :ts_esu ) +if %winbuild% LSS 9200 if /i %tsmethod%==KMS4k goto :ts_oldks if defined _vis goto :ts_winvista set tempid= -set keytype=zero +if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -4222,6 +4367,13 @@ echo Checking Activation ID [%tempid%] [%tsedition%] ) else ( call :dk_color %Red% "Checking Activation ID [Not Found] [%tsedition%] [%osSKU%]" set error=1 +if /i %tsmethod%==KMS4k ( +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +) goto :ts_esu ) @@ -4229,6 +4381,83 @@ if defined winsub ( call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]." echo: ) + +goto :ts_esu + +::======================================================================================================================================== + +:ts_oldks + +:: KMS keys for KMS4k method because TSforge cannot install KMS key on Windows Vista and 7 + +:: 1st column = Activation ID +:: 2nd column = Generic key +:: 3rd column = Edition ID +:: Separator = _ + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: Windows 7 +ae2ee509-1b34-41c0-acb7-6d4650168915_33PXH-7Y6KF-2VJC9-XBBR8-HV%f%THH_Enterprise +1cb6d605-11b3-4e14-bb30-da91c8e3983a_YDRBP-3D83W-TY26F-D46B2-XC%f%KRJ_EnterpriseN +b92e9980-b9d5-4821-9c94-140f632f6312_FJ82H-XT6CR-J8D7P-XQJJ2-GP%f%DD4_Professional +54a09a0d-d57b-4c10-8b69-a842d6590ad5_MRPKT-YTG23-K7D7T-X2JMM-QY%f%7MG_ProfessionalN +db537896-376f-48ae-a492-53d0547773d0_YBYF6-BHCR3-JPKRB-CDW7B-F9%f%BK4_Embedded_POSReady +aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395_73KQT-CD9G6-K7TQG-66MRP-CQ%f%22C_Embedded_ThinPC +5a041529-fef8-4d07-b06f-b59b573b32d2_W82YF-2Q76Y-63HXB-FGJG9-GF%f%7QX_ProfessionalE +46bbed08-9c7b-48fc-a614-95250573f4ea_C29WB-22CC8-VJ326-GHFJW-H9%f%DH4_EnterpriseE +:: Windows Server 2008 R2 +68531fb9-5511-4989-97be-d11a0f55633f_YC6KT-GKW9T-YTKYR-T4X34-R7%f%VHC_ServerStandard +7482e61b-c589-4b7f-8ecc-46d455ac3b87_74YFP-3QFB3-KQT8W-PMXWJ-7M%f%648_ServerDatacenter +620e2b3d-09e7-42fd-802a-17a13652fe7a_489J6-VHDMP-X63PK-3K798-CP%f%X3Y_ServerEnterprise +7482e61b-c589-4b7f-8ecc-46d455ac3b87_74YFP-3QFB3-KQT8W-PMXWJ-7M%f%648_ServerDatacenterCore +68531fb9-5511-4989-97be-d11a0f55633f_YC6KT-GKW9T-YTKYR-T4X34-R7%f%VHC_ServerStandardCore +620e2b3d-09e7-42fd-802a-17a13652fe7a_489J6-VHDMP-X63PK-3K798-CP%f%X3Y_ServerEnterpriseCore +8a26851c-1c7e-48d3-a687-fbca9b9ac16b_GT63C-RJFQ3-4GMB6-BRFB9-CB%f%83V_ServerEnterpriseIA64 +a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4_ServerWeb +cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX_ServerHPC +a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4_ServerWebCore +f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K_ServerEmbeddedSolution +:: Windows Vista +cfd8ff08-c0d7-452b-9f60-ef5c70c32094_VKK3X-68KWM-X2YGT-QR4M6-4B%f%WMV_Enterprise +4f3d1606-3fea-4c01-be3c-8d671c401e3b_YFKBB-PQJJV-G996G-VWGXY-2V%f%3X8_Business +2c682dc2-8b68-4f63-a165-ae291d4cf138_HMBQG-8H2RH-C77VX-27R82-VM%f%QBT_BusinessN +d4f54950-26f2-4fb4-ba21-ffab16afcade_VTC42-BM838-43QHV-84HX6-XJ%f%XKV_EnterpriseN +:: Windows Server 2008 +ad2542d4-9154-4c6d-8a44-30f11ee96989_TM24T-X9RMF-VWXK6-X8JC9-BF%f%GM2_ServerStandard +68b6e220-cf09-466b-92d3-45cd964b9509_7M67G-PC374-GR742-YH8V4-TC%f%BY3_ServerDatacenter +c1af4d90-d1bc-44ca-85d4-003ba33db3b9_YQGMW-MPWTJ-34KDK-48M3W-X4%f%Q6V_ServerEnterprise +01ef176b-3e0d-422a-b4f8-4ea880035e8f_4DWFP-JF3DJ-B7DTH-78FJB-PD%f%RHK_ServerEnterpriseIA64 +ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b_WYR28-R7TFJ-3X2YQ-YCY4H-M2%f%49D_ServerWeb +7afb1156-2c1d-40fc-b260-aab7442b62fe_RCTX3-KWVHP-BR6TB-RB6DM-6X%f%7HP_ServerComputeCluster +2401e3d0-c50a-4b58-87b2-7e794b7d2607_W7VD6-7JFBR-RX26B-YKQ3Y-6F%f%FFJ_ServerStandardV +fd09ef77-5647-4eff-809c-af2b64659a45_22XQ2-VRXRG-P8D42-K34TD-G3%f%QQC_ServerDatacenterV +8198490a-add0-47b2-b3ba-316b12d647b4_39BXF-X8Q23-P2WWT-38T2F-G3%f%FPG_ServerEnterpriseV +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do if %tsedition%==%%C if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) + +if not defined key ( +call :dk_color %Red% "Checking Activation ID [%tsedition% SKU-%osSKU% %KS% key is not available]" +call :dk_color %Blue% "Use ZeroCID activation method from the previous menu." +goto :ts_esu +) + +echo Checking Activation ID [%tempid%] [%tsedition%] + +set oldks=1 +set generickey=1 +call :dk_inskey "[%key%]" +set tsids=%tsids% %tempid% goto :ts_esu ::======================================================================================================================================== @@ -4309,7 +4538,7 @@ echo Checking Activation ID [%tempid%] [%tsedition%] set generickey=1 call :dk_inskey "[%key%]" -if not defined error set tsids=%tsids% %tempid% +set tsids=%tsids% %tempid% goto :ts_esu ::======================================================================================================================================== @@ -4438,6 +4667,15 @@ call :dk_inskey "[%key%]" :ts_esu if not %_actesu%==1 goto :ts_off +if /i %tsmethod%==KMS4k ( +call :dk_color %Red% "Skipping Windows ESU [KMS4k method is not supported with Windows ESU]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_off +) :: Process Windows ESU @@ -4511,7 +4749,8 @@ goto :ts_off if defined esuexistsup ( echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && ( echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || ( -call :dk_color %Gray% "Now update Windows to get Client-ESU-Year6[4-6y] license and activate that using this script." +call :dk_color %Gray% "To get Client-ESU-Year6[4-6y] license, install updates from the below URL." +call :dk_color %Blue% "%mas%tsforge#windows-esu" ) ) goto :ts_off @@ -4524,8 +4763,12 @@ goto :ts_off if defined esuexistbutnosup ( call :dk_color %Red% "Checking Activation ID [Commercial ESU is not supported for %tsedition%]" +echo %esueditionlist% | find /i "Professional" %nul1% && ( +call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option, and change it to [Professional] or any non-Home edition." +) || ( call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions." echo [%esueditionlist%] +) goto :ts_off ) @@ -4586,8 +4829,8 @@ set o14c2r= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) %nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R @@ -4650,7 +4893,7 @@ call :dk_color %Gray% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You have only Office dashboard app installed, you need to install full Office version. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) call :dk_color %Blue% "Download and install Office from below URL and try again." if %_actwin%==0 set fixes=%fixes% %mas%genuine-installation-media @@ -4754,6 +4997,7 @@ set error=1 goto :ts_starto16c2r ) +call :oh_expiredpreview 2013 if "%_actprojvis%"=="0" call :oh_fixprids call :ts_process @@ -4795,11 +5039,30 @@ set error=1 goto :ts_startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 if "%_actprojvis%"=="0" call :oh_fixprids call :ts_process ::======================================================================================================================================== +:: mass grave[.]dev/office-license-is-not-genuine +:: Add registry keys for volume products so that 'non-genuine' banner won't appear + +set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" +if /i %tsmethod%==KMS4k ( +if %winbuild% GEQ 9200 ( +if not "%osarch%"=="x86" ( +reg delete "%kmskey%" /f /reg:32 %nul% +reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" /reg:32 %nul% +) +reg delete "%kmskey%" /f %nul% +reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" %nul% +echo Adding a Registry to Prevent Banner [Successful] +) +) + +::======================================================================================================================================== + :ts_startmsi if defined o15msi call :ts_processmsi 15 %o15msi_reg% @@ -4823,6 +5086,17 @@ goto :ts_act echo: echo Processing Windows %KS% Host... +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Windows %KS% Host [KMS4k method is not supported with Windows %KS% Host]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_act +) + echo: if %winbuild% GEQ 10586 ( call :dk_color %Gray% "With %KS% Host license, system may randomly change Windows Edition later. It is a Windows issue and can be safely ignored." @@ -4916,7 +5190,7 @@ goto :ts_act ) call :dk_inskey "[%key%]" -if not defined error set tsids=%tsids% %tempid% +set tsids=%tsids% %tempid% goto :ts_act ::======================================================================================================================================== @@ -4934,6 +5208,17 @@ call :dk_color %Blue% "Windows Vista and Server 2008 do not support the installa goto :ts_act ) +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Office %KS% Host [KMS4k method is not supported with Office %KS% Host]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_act +) + set ohostexist= call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 set ohostids=%allapps% @@ -4986,6 +5271,17 @@ call :dk_color %Gray% "Checking Activation ID [APPX Sideloading goto :dk_done ) +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Windows 8/8.1 APPX [KMS4k method is not supported with Windows 8/8.1 APPX]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :dk_done +) + set appxexist= if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f @@ -5044,6 +5340,17 @@ echo: echo Processing Manual Activation... echo: +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Manual Activation [KMS4k method is not supported with it]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :dk_done +) + call :dk_color %Gray% "This option is for advanced users, those who already know what they are doing." call :dk_color %Blue% "Some activation IDs may cause system crash [MUI mismatch], or irreversible changes [CloudEdition etc]." @@ -5203,12 +5510,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble if defined tsids ( echo: -if not defined _vis echo Installing Forged Product Key Data... -echo Depositing Zero Confirmation ID... +if not defined _vis if not defined oldks echo Installing Forged Product Key Data... +if /i %tsmethod%==KMS4k ( +echo Writing TrustedStore data... +) else ( +if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) +) echo: %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" if !errorlevel!==3 ( -if %_actman%==0 call :dk_color %Blue% "%_fixmsg%" +if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( @@ -5301,10 +5612,10 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" % for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) exit /b @@ -5324,6 +5635,19 @@ set _preview= set _License=%%# set skipprocess= + +set foundprod= +call :tsksdata chkprod %%# +if defined _oMSI if not defined foundprod if /i %tsmethod%==KMS4k ( +set skipprocess=1 +call :dk_color %Red% "Checking Product In Script [%%# MSI Retail is not supported with KMS4k]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +) + if "%_actprojvis%"=="1" ( echo %%# | findstr /i "Project Visio" %nul% || ( set skipprocess=1 @@ -5331,8 +5655,17 @@ call :dk_color %Gray% "Skipping Because Project/Visio Mode [%%#]" ) ) +if "%_actprojvis%"=="0" if /i %tsmethod%==KMS4k echo %_oIds% | findstr /i "O365" %nul% && ( +echo %%# | findstr /i "Project Visio" %nul% && ( +set skipprocess=1 +echo Skipping Because Mondo Is Available [%%#] +) +) + + if not defined skipprocess ( +if /i not %tsmethod%==KMS4k ( set no365= if "%oVer%"=="15" (echo %%# | findstr /i "O365HomePremRetail" %nul% && set no365=1) if "%oVer%"=="16" (echo %%# | findstr /i "O365" %nul% && set no365=1) @@ -5342,6 +5675,8 @@ set _License=MondoRetail set _altoffid=MondoRetail call :ks_osppready echo Converting Unsupported O365 Office [%%# To MondoRetail] +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") ) if not defined _oMSI ( @@ -5352,8 +5687,30 @@ call :ks_osppready echo Converting Unsupported OEM-ARM Office [%%# To MondoRetail] ) ) +) +if not defined _oMSI if /i %tsmethod%==KMS4k if not defined foundprod ( +call :tsksdata getinfo %%# +if defined _altoffid ( +echo Converting Retail To Volume [%%# To !_altoffid!] +) else ( +set _License=MondoVolume +set _altoffid=MondoVolume +echo Converting Retail To Volume [%%# To !_altoffid!] [Using Mondo because %%# is not found in the script] +) +echo %%# | find /i "O365" %nul% && ( +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") +) +call :ks_osppready +) + +if /i %tsmethod%==KMS4k ( +echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=ks) +) else ( set keytype=zero +) + for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) ) @@ -5382,7 +5739,7 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( +if /i not %tsmethod%==KMS4k if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% @@ -5448,6 +5805,220 @@ exit /b :tsforge: $src = @' +#if !POWERSHELL2 +namespace ActivationWs +{ + +/* + +This code is adapted from ActivationWs. +Original Repository: https://github.com/dadorner-msft/activationws + +MIT License + +Copyright (c) Daniel Dorner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +using System; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Text; +using System.Xml.Linq; + + public static class ActivationHelper { + // Key for HMAC/SHA256 signature. + private static readonly byte[] MacKey = new byte[64] { + 254, 49, 152, 117, 251, 72, 132, 134, + 156, 243, 241, 206, 153, 168, 144, 100, + 171, 87, 31, 202, 71, 4, 80, 88, + 48, 36, 226, 20, 98, 135, 121, 160, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }; + + private const string Action = "http://www.microsoft.com/BatchActivationService/BatchActivate"; + + private static readonly Uri Uri = new Uri("https://activation.sls.microsoft.com/BatchActivation/BatchActivation.asmx"); + + private static readonly XNamespace SoapSchemaNs = "http://schemas.xmlsoap.org/soap/envelope/"; + private static readonly XNamespace XmlSchemaInstanceNs = "http://www.w3.org/2001/XMLSchema-instance"; + private static readonly XNamespace XmlSchemaNs = "http://www.w3.org/2001/XMLSchema"; + private static readonly XNamespace BatchActivationServiceNs = "http://www.microsoft.com/BatchActivationService"; + private static readonly XNamespace BatchActivationRequestNs = "http://www.microsoft.com/DRM/SL/BatchActivationRequest/1.0"; + private static readonly XNamespace BatchActivationResponseNs = "http://www.microsoft.com/DRM/SL/BatchActivationResponse/1.0"; + + public static string CallWebService(int requestType, string installationId, string extendedProductId) { + XDocument soapRequest = CreateSoapRequest(requestType, installationId, extendedProductId); + HttpWebRequest webRequest = CreateWebRequest(soapRequest); + XDocument soapResponse = new XDocument(); + + try { + IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null); + asyncResult.AsyncWaitHandle.WaitOne(); + + // Read data from the response stream. + using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult)) + using (StreamReader streamReader = new StreamReader(webResponse.GetResponseStream())) { + soapResponse = XDocument.Parse(streamReader.ReadToEnd()); + } + + return ParseSoapResponse(soapResponse); + + } catch { + throw; + } + } + + private static XDocument CreateSoapRequest(int requestType, string installationId, string extendedProductId) { + // Create an activation request. + XElement activationRequest = new XElement(BatchActivationRequestNs + "ActivationRequest", + new XElement(BatchActivationRequestNs + "VersionNumber", "2.0"), + new XElement(BatchActivationRequestNs + "RequestType", requestType), + new XElement(BatchActivationRequestNs + "Requests", + new XElement(BatchActivationRequestNs + "Request", + new XElement(BatchActivationRequestNs + "PID", extendedProductId), + requestType == 1 ? new XElement(BatchActivationRequestNs + "IID", installationId) : null) + ) + ); + + // Get the unicode byte array of activationRequest and convert it to Base64. + byte[] bytes = Encoding.Unicode.GetBytes(activationRequest.ToString()); + string requestXml = Convert.ToBase64String(bytes); + + XDocument soapRequest = new XDocument(); + + using (HMACSHA256 hMACSHA = new HMACSHA256(MacKey)) { + // Convert the HMAC hashed data to Base64. + string digest = Convert.ToBase64String(hMACSHA.ComputeHash(bytes)); + + soapRequest = new XDocument( + new XDeclaration("1.0", "UTF-8", "no"), + new XElement(SoapSchemaNs + "Envelope", + new XAttribute(XNamespace.Xmlns + "soap", SoapSchemaNs), + new XAttribute(XNamespace.Xmlns + "xsi", XmlSchemaInstanceNs), + new XAttribute(XNamespace.Xmlns + "xsd", XmlSchemaNs), + new XElement(SoapSchemaNs + "Body", + new XElement(BatchActivationServiceNs + "BatchActivate", + new XElement(BatchActivationServiceNs + "request", + new XElement(BatchActivationServiceNs + "Digest", digest), + new XElement(BatchActivationServiceNs + "RequestXml", requestXml) + ) + ) + ) + )); + + } + + return soapRequest; + } + + private static HttpWebRequest CreateWebRequest(XDocument soapRequest) { + HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(Uri); + webRequest.Accept = "text/xml"; + webRequest.ContentType = "text/xml; charset=\"utf-8\""; + webRequest.Headers.Add("SOAPAction", Action); + webRequest.Host = "activation.sls.microsoft.com"; + webRequest.Method = "POST"; + + try { + // Insert SOAP envelope + using (Stream stream = webRequest.GetRequestStream()) { + soapRequest.Save(stream); + } + + return webRequest; + + } catch { + throw; + } + } + + private static string ParseSoapResponse(XDocument soapResponse) { + if (soapResponse == null) { + throw new ArgumentNullException("soapResponse", "The remote server returned an unexpected response."); + } + + if (!soapResponse.Descendants(BatchActivationServiceNs + "ResponseXml").Any()) { + throw new Exception("The remote server returned an unexpected response"); + } + + try { + XDocument responseXml = XDocument.Parse(soapResponse.Descendants(BatchActivationServiceNs + "ResponseXml").First().Value); + + if (responseXml.Descendants(BatchActivationResponseNs + "ErrorCode").Any()) { + string errorCode = responseXml.Descendants(BatchActivationResponseNs + "ErrorCode").First().Value; + + switch (errorCode) { + case "0x7F": + throw new Exception("The Multiple Activation Key has exceeded its limit"); + + case "0x67": + throw new Exception("The product key has been blocked"); + + case "0x68": + throw new Exception("Invalid product key"); + + case "0x86": + throw new Exception("Invalid key type"); + + case "0x90": + throw new Exception("Please check the Installation ID and try again"); + + default: + throw new Exception(string.Format("The remote server reported an error ({0})", errorCode)); + } + + } else if (responseXml.Descendants(BatchActivationResponseNs + "ResponseType").Any()) { + string responseType = responseXml.Descendants(BatchActivationResponseNs + "ResponseType").First().Value; + + switch (responseType) { + case "1": + string confirmationId = responseXml.Descendants(BatchActivationResponseNs + "CID").First().Value; + return confirmationId; + + case "2": + string activationsRemaining = responseXml.Descendants(BatchActivationResponseNs + "ActivationRemaining").First().Value; + return activationsRemaining; + + default: + throw new Exception("The remote server returned an unrecognized response"); + } + + } else { + throw new Exception("The remote server returned an unrecognized response"); + } + + } catch { + throw; + } + } + } +} +#endif + // Common.cs namespace LibTSforge { @@ -8009,27 +8580,23 @@ namespace LibTSforge.Modifiers } -// Activators/AVMA4K.cs +// Activators/KMS4K.cs namespace LibTSforge.Activators { using System; + using System.IO; using PhysicalStore; using SPP; - public static class AVMA4k + public class KMS4k { public static void Activate(PSVersion version, bool production, Guid actId) { - if (version != PSVersion.WinModern && version != PSVersion.WinBlue) - { - throw new NotSupportedException("AVMA licenses are not available for this product."); - } - Guid appId; if (actId == Guid.Empty) { appId = SLApi.WINDOWS_APP_ID; - actId = SLApi.GetDefaultActivationID(appId, false); + actId = SLApi.GetDefaultActivationID(appId, true); if (actId == Guid.Empty) { @@ -8041,9 +8608,9 @@ namespace LibTSforge.Activators appId = SLApi.GetAppId(actId); } - if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "VT:IA") + if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "Volume:GVLK") { - throw new NotSupportedException("Non-VT:IA product key installed."); + throw new NotSupportedException("Non-Volume:GVLK product key installed."); } SPPUtils.KillSPP(version); @@ -8054,80 +8621,171 @@ namespace LibTSforge.Activators { string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); - long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); - long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); - long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + ulong unknown = 0; + ulong time1; + ulong time2 = (ulong)DateTime.UtcNow.ToFileTime(); + ulong expiry = Constants.TimerMax; - const ulong unknown = 0; - ulong time1 = (ulong)(creationTime + tickCount + deltaTime); - ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime(); - ulong timerTime = crcBindTime / 10000; - ulong expiry = Constants.TimerMax / 10000; - - VariableBag avmaBinding = new VariableBag(version); - - avmaBinding.Blocks.AddRange(new[] + if (version == PSVersion.Vista || version == PSVersion.Win7) { + unknown = 0x800000000; + time1 = 0; + } + else + { + long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); + long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); + long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + + time1 = (ulong)(creationTime + tickCount + deltaTime); + time2 /= 10000; + expiry /= 10000; + } + + if (version == PSVersion.Vista) + { + VistaTimer vistaTimer = new VistaTimer + { + Time = time2, + Expiry = Constants.TimerMax + }; + + string vistaTimerName = string.Format("msft:sl/timer/VLExpiration/VOLUME/{0}/{1}", appId, actId); + + store.DeleteBlock(key, vistaTimerName); + store.DeleteBlock(key, actId.ToString()); + + BinaryWriter writer = new BinaryWriter(new MemoryStream()); + writer.Write(Constants.KMSv4Response.Length); + writer.Write(Constants.KMSv4Response); + writer.Write(Constants.UniversalHWIDBlock); + byte[] kmsData = writer.GetBytes(); + + store.AddBlocks(new[] + { + new PSBlock + { + Type = BlockType.TIMER, + Flags = 0, + KeyAsStr = key, + ValueAsStr = vistaTimerName, + Data = vistaTimer.CastToArray() + }, + new PSBlock + { + Type = BlockType.NAMED, + Flags = 0, + KeyAsStr = key, + ValueAsStr = actId.ToString(), + Data = kmsData + } + }); + } + else + { + byte[] hwidBlock = Constants.UniversalHWIDBlock; + byte[] kmsResp; + + switch (version) + { + case PSVersion.Win7: + kmsResp = Constants.KMSv4Response; + break; + case PSVersion.Win8: + kmsResp = Constants.KMSv5Response; + break; + case PSVersion.WinBlue: + case PSVersion.WinModern: + kmsResp = Constants.KMSv6Response; + break; + default: + throw new NotSupportedException("Unsupported PSVersion."); + } + + VariableBag kmsBinding = new VariableBag(version); + + kmsBinding.Blocks.AddRange(new[] + { new CRCBlockModern { DataType = CRCBlockType.BINARY, Key = new byte[] { }, - Value = BitConverter.GetBytes(crcBindTime), + Value = kmsResp }, new CRCBlockModern { DataType = CRCBlockType.STRING, Key = new byte[] { }, - ValueAsStr = "AVMA4K", + ValueAsStr = "msft:rm/algorithm/hwid/4.0" }, new CRCBlockModern { - DataType = CRCBlockType.STRING, - Key = new byte[] { }, - ValueAsStr = "00491-50000-00001-AA666", + DataType = CRCBlockType.BINARY, + KeyAsStr = "SppBindingLicenseData", + Value = hwidBlock } - }); + }); - byte[] avmaBindingData = avmaBinding.Serialize(); + if (version == PSVersion.WinModern) + { + kmsBinding.Blocks.AddRange(new[] + { + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "massgrave.dev" + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "6969" + } + }); + } - Timer avmaTimer = new Timer - { - Unknown = unknown, - Time1 = time1, - Time2 = timerTime, - Expiry = expiry - }; + byte[] kmsBindingData = kmsBinding.Serialize(); - string storeVal = string.Format("msft:spp/ia/bind/1.0/store/{0}/{1}", appId, actId); - string timerVal = string.Format("msft:spp/ia/bind/1.0/timer/{0}/{1}", appId, actId); + Timer kmsTimer = new Timer + { + Unknown = unknown, + Time1 = time1, + Time2 = time2, + Expiry = expiry + }; - store.DeleteBlock(key, storeVal); - store.DeleteBlock(key, timerVal); + string storeVal = string.Format("msft:spp/kms/bind/2.0/store/{0}/{1}", appId, actId); + string timerVal = string.Format("msft:spp/kms/bind/2.0/timer/{0}/{1}", appId, actId); - store.AddBlocks(new[] - { + store.DeleteBlock(key, storeVal); + store.DeleteBlock(key, timerVal); + + store.AddBlocks(new[] + { new PSBlock { Type = BlockType.NAMED, - Flags = 0x400, + Flags = (version == PSVersion.WinModern) ? (uint)0x400 : 0, KeyAsStr = key, ValueAsStr = storeVal, - Data = avmaBindingData, + Data = kmsBindingData }, new PSBlock { Type = BlockType.TIMER, - Flags = 0x4, + Flags = (version == PSVersion.Win7) ? (uint)0 : 0x4, KeyAsStr = key, ValueAsStr = timerVal, - Data = avmaTimer.CastToArray() + Data = kmsTimer.CastToArray() } - }); + }); + } } - SLApi.RefreshLicenseStatus(); + SPPUtils.RestartSPP(version); SLApi.FireStateChangedEvent(appId); - Logger.WriteLine("Activated using AVMA4k successfully."); + Logger.WriteLine("Activated using KMS4k successfully."); } } } @@ -10234,15 +10892,16 @@ namespace LibTSforge.PhysicalStore '@ $ErrorActionPreference = 'Stop' $binPath = "$env:_work\BIN\LibTSforge.dll" +$psMajorVer = (Get-Host).Version.Major if (Test-Path -LiteralPath $binPath) { Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." Add-Type -Path $binPath } else { - $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") - $cp.CompilerOptions = "/unsafe" - $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } + $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll") + if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" } + $lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" } $ctemp = "$env:SystemRoot\Temp\" if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } @@ -10291,32 +10950,65 @@ function slGetSkuInfo($SkuId) { if (-not $env:resetstuff) { foreach ($tsactid in $tsactids) { try { + $activated = $null $prodDes = Get-WmiInfo -tsactid $tsactid -property "Description" $prodName = Get-WmiInfo -tsactid $tsactid -property "Name" if ($prodName) { $nameParts = $prodName -split ',', 2 $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } - if (-not $env:_vis) { - [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) - } - if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { + if (-not $env:_vis -and -not $env:oldks) { + [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + } + if ($prodName -match 'Office' -and $prodDes -notmatch 'KMS' -and -not (slGetSkuInfo($tsactid))) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { Write-Host "[$prodName] is already permanently activated." -ForegroundColor White -BackgroundColor DarkGreen continue } } - [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) - $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" - if ($licenseStatus -eq 1) { + if ($env:tsmethod -eq "StaticCID") { + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + $attempts = @( + @(100055, 1000043, 1338662172562478), + @(1345, 1003020, 6311608238084405) + ) + foreach ($params in $attempts) { + [LibTSforge.Modifiers.SetIIDParams]::SetParams($ver, $prod, $tsactid, [LibTSforge.SPP.PKeyAlgorithm]::PKEY2009, $params[0], $params[1], $params[2]) + $instId = [LibTSforge.SPP.SLApi]::GetInstallationID($tsactid) + $confId = [ActivationWs.ActivationHelper]::CallWebService(1, $instId, "31337-42069-123-456789-04-1337-2600.0000-2542001") + $result = [LibTSforge.SPP.SLApi]::DepositConfirmationID($tsactid, $instId, $confId) + if ($result -eq 0) { break } + } + [LibTSforge.SPP.SPPUtils]::RestartSPP($ver) + } + elseif ($env:tsmethod -eq "KMS4k") { + [LibTSforge.Activators.KMS4k]::Activate($ver, $prod, $tsactid) + } + else { + [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) + } + if ($env:tsmethod -eq "KMS4k") { + $GracePeriodStatus = Get-WmiInfo -tsactid $tsactid -property "GracePeriodRemaining" + if ($GracePeriodStatus -gt 259200) { $activated = 1 } + } + else { + $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" + if ($licenseStatus -eq 1) { $activated = 1 } + } + if ($activated) { if ($prodDes -match 'KMS' -and $prodDes -notmatch 'CLIENT') { [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $prod, $tsactid) - Write-Host "[$prodName] CSVLK is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen + Write-Host "[$prodName] CSVLK is permanently activated with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] CSVLK is charged with 25 clients for 30 days." -ForegroundColor White -BackgroundColor DarkGreen } else { - Write-Host "[$prodName] is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen + if ($env:tsmethod -eq "KMS4k") { + Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen + } + else { + Write-Host "[$prodName] is permanently activated with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen + } } } else { @@ -10334,11 +11026,11 @@ if (-not $env:resetstuff) { if ($env:resetstuff) { try { - if (-not $env:_vis) {[LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod)} + if (-not $env:_vis) { [LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod) } [LibTSforge.SPP.SLApi]::RefreshLicenseStatus() [LibTSforge.Modifiers.RearmReset]::Reset($ver, $prod) [LibTSforge.Modifiers.GracePeriodReset]::Reset($ver, $prod) - if (-not $env:_vis) {[LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod)} + if (-not $env:_vis) { [LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod) } } catch { $errcode = 3 @@ -10583,7 +11275,7 @@ function Office-ActID { } } - $filterPreview = $filteredConfigs | Where-Object { $_.ProductDescription -notmatch 'preview' } + $filterPreview = $filteredConfigs | Where-Object { $_.ProductDescription -notmatch 'preview|c2r' } if ($filterPreview.Count -ne 0) { $filteredConfigs = $filterPreview @@ -10598,6 +11290,130 @@ Office-ActID -pkeypath "$env:pkeypath" -edition "$env:_License" -keytype "$env:k ::======================================================================================================================================== +:: 1st column = Office version +:: 2nd column = Volume or free retail product +:: 3rd column = Retail product names that needs to be converted to the Volume product mentioned in 2nd column +:: Separator = "_" + +:tsksdata + +set f= +for %%# in ( +:: Office 2013 +15_AccessVolume_-AccessRetail- +15_AccessRuntimeRetail +15_ExcelVolume_-ExcelRetail- +15_GrooveVolume_-GrooveRetail- +15_InfoPathVolume_-InfoPathRetail- +15_LyncAcademicRetail +15_LyncEntryRetail +15_LyncVolume_-LyncRetail- +15_MondoRetail +15_MondoVolume_-O365BusinessRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +15_OneNoteFreeRetail +15_OneNoteVolume_-OneNoteRetail- +15_OutlookVolume_-OutlookRetail- +15_PowerPointVolume_-PowerPointRetail- +15_ProjectProVolume_-ProjectProRetail- +15_ProjectStdVolume_-ProjectStdRetail- +15_ProPlusVolume_-ProPlusRetail-ProfessionalPipcRetail-ProfessionalRetail- +15_PublisherVolume_-PublisherRetail- +15_SPDRetail +15_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-PersonalPipcRetail-PersonalRetail- +15_VisioProVolume_-VisioProRetail- +15_VisioStdVolume_-VisioStdRetail- +15_WordVolume_-WordRetail- +:: Office 2016 +16_AccessRuntimeRetail +16_AccessVolume_-AccessRetail- +16_ExcelVolume_-ExcelRetail- +16_MondoRetail +16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +16_OneNoteFreeRetail +16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail- +16_OutlookVolume_-OutlookRetail- +16_PowerPointVolume_-PowerPointRetail- +16_ProjectProVolume_-ProjectProRetail- +16_ProjectProXVolume +16_ProjectStdVolume_-ProjectStdRetail- +16_ProjectStdXVolume +16_ProPlusVolume_-ProPlusRetail-ProfessionalPipcRetail-ProfessionalRetail- +16_PublisherVolume_-PublisherRetail- +16_SkypeServiceBypassRetail +16_SkypeforBusinessEntryRetail +16_SkypeforBusinessVolume_-SkypeforBusinessRetail- +16_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-HomeStudentVNextRetail-PersonalPipcRetail-PersonalRetail- +16_VisioProVolume_-VisioProRetail- +16_VisioProXVolume +16_VisioStdVolume_-VisioStdRetail- +16_VisioStdXVolume +16_WordVolume_-WordRetail- +:: Office 2019 +16_AccessRuntime2019Retail +16_Access2019Volume_-Access2019Retail- +16_Excel2019Volume_-Excel2019Retail- +16_Outlook2019Volume_-Outlook2019Retail- +16_PowerPoint2019Volume_-PowerPoint2019Retail- +16_ProjectPro2019Volume_-ProjectPro2019Retail- +16_ProjectStd2019Volume_-ProjectStd2019Retail- +16_ProPlus2019Volume_-ProPlus2019Retail-Professional2019Retail- +16_Publisher2019Volume_-Publisher2019Retail- +16_SkypeforBusiness2019Volume_-SkypeforBusiness2019Retail- +16_SkypeforBusinessEntry2019Retail +16_Standard2019Volume_-Standard2019Retail-HomeBusiness2019Retail-HomeStudentARM2019Retail-HomeStudentPlusARM2019Retail-HomeStudent2019Retail-Personal2019Retail- +16_VisioPro2019Volume_-VisioPro2019Retail- +16_VisioStd2019Volume_-VisioStd2019Retail- +16_Word2019Volume_-Word2019Retail- +:: Office 2021 +:: OneNote2021Volume KMS license is not available +16_AccessRuntime2021Retail +16_Access2021Volume_-Access2021Retail- +16_Excel2021Volume_-Excel2021Retail- +16_Outlook2021Volume_-Outlook2021Retail- +16_OneNoteFree2021Retail +16_PowerPoint2021Volume_-PowerPoint2021Retail- +16_ProjectPro2021Volume_-ProjectPro2021Retail- +16_ProjectStd2021Volume_-ProjectStd2021Retail- +16_ProPlus2021Volume_-ProPlus2021Retail-Professional2021Retail- +16_Publisher2021Volume_-Publisher2021Retail- +16_SkypeforBusiness2021Volume_-SkypeforBusiness2021Retail- +16_Standard2021Volume_-Standard2021Retail-HomeBusiness2021Retail-HomeStudent2021Retail-Personal2021Retail- +16_VisioPro2021Volume_-VisioPro2021Retail- +16_VisioStd2021Volume_-VisioStd2021Retail- +16_Word2021Volume_-Word2021Retail- +:: Office 2024 +16_Access2024Volume_-Access2024Retail- +16_Excel2024Volume_-Excel2024Retail- +16_Outlook2024Volume_-Outlook2024Retail- +16_PowerPoint2024Volume_-PowerPoint2024Retail- +16_ProjectPro2024Volume_-ProjectPro2024Retail- +16_ProjectStd2024Volume_-ProjectStd2024Retail- +16_ProPlus2024Volume_-ProPlus2024Retail- +16_SkypeforBusiness2024Volume +16_Standard2024Volume_-Home2024Retail-HomeBusiness2024Retail- +16_VisioPro2024Volume_-VisioPro2024Retail- +16_VisioStd2024Volume_-VisioStd2024Retail- +16_Word2024Volume_-Word2024Retail- +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( + +if %1==chkprod if "%oVer%"=="%%A" if not defined foundprod ( +if /i "%%B"=="%2" set foundprod=1 +) + +if %1==getinfo if "%oVer%"=="%%A" ( +echo: %%C | find /i "-%2-" %nul% && ( +set _License=%%B +set _altoffid=%%B +) +) + +) +) +exit /b + +::======================================================================================================================================== + :ts_getedition set tsedition= @@ -10960,11 +11776,13 @@ if defined _fmiss ( %eline% echo [%_fmiss%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -11790,11 +12608,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -12073,7 +12893,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You have only Office dashboard app installed, you need to install full Office version. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) call :dk_color %Blue% "Download and install Office from below URL and try again." set fixes=%fixes% %mas%genuine-installation-media @@ -12165,6 +12985,7 @@ set error=1 goto :ks_starto16c2r ) +call :oh_expiredpreview 2013 if "%_actprojvis%"=="0" call :oh_fixprids call :ks_process @@ -12205,6 +13026,7 @@ set error=1 goto :ks_startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 if "%_actprojvis%"=="0" call :oh_fixprids call :ks_process @@ -12230,7 +13052,7 @@ call :oh_licrefresh :ks_activate :: Opt out of sending KMSclient activation data to Microsoft -:: https://learn.microsoft.com/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform +:: https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform if %winbuild% GEQ 9600 ( reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f %nul% @@ -12298,7 +13120,7 @@ echo Cleared %KS% Server from the registry. ) ) -:: https://learn.microsoft.com/azure/virtual-desktop/windows-10-multisession-faq +:: https://learn.microsoft.com/en-us/azure/virtual-desktop/windows-10-multisession-faq if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# ( call :dk_color %Red% "%winos% does not support activation on non-azure platforms." @@ -12452,6 +13274,10 @@ call :ksdata getinfo !_prod! if defined _altoffid ( set _License=!_altoffid! echo Converting Retail To Volume [!_prod! To !_altoffid!] +echo %%# | find /i "O365" %nul% && ( +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") +) set _prod=!_altoffid! call :ks_osppready ) @@ -12467,7 +13293,7 @@ call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 ! call :dk_color %Blue% "Make sure you are using Latest MAS script." ) else ( call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]" -call :dk_color %Blue% "Use Ohook option to activate it." +call :dk_color %Blue% "Use Ohook option to activate it. To activate with %KS%, you need to install Volume version of Office." ) set fixes=%fixes% %mas%genuine-installation-media call :dk_color %_Yellow% "%mas%genuine-installation-media" @@ -13113,8 +13939,8 @@ set srvlist= set -= set "srvlist=kms.03%-%k.org kms-default.cangs%-%hui.net kms.six%-%yin.com kms.moe%-%club.org kms.cgt%-%soft.com" -set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.my%-%ds.cloud" -set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%pym.com" +set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.mc%-%06.net" +set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%xi.com" set n=1 for %%a in (%srvlist%) do (set %%a=&set server!n!=%%a&set /a n+=1) @@ -13848,7 +14674,7 @@ d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3_6Q7VD-NX8JD-WJ2VH-88V73-4G%f%BJ7__15_WordVo 67c0fc0c-deba-401b-bf8b-9c8ad8395804_GNH9Y-D2J4T-FJHGG-QRVH7-QP%f%FDW__16_AccessVolume_-AccessRetail- c3e65d36-141f-4d2f-a303-a842ee756a29_9C2PK-NWTVB-JMPW8-BFT28-7F%f%TBF__16_ExcelVolume_-ExcelRetail- e914ea6e-a5fa-4439-a394-a9bb3293ca09_DMTCJ-KNRKX-26982-JYCKT-P7%f%KB6__16_MondoRetail -9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- 436366de-5579-4f24-96db-3893e4400030_XYNTG-R96FY-369HX-YFPHY-F9%f%CPM__16_OneNoteFreeRetail_[Bypass] d8cace59-33d2-4ac7-9b1b-9b72339c51c8_DR92N-9HTF2-97XKM-XW2WJ-XW%f%3J6__16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail- ec9d9265-9d1e-4ed0-838a-cdc20f2551a1_R69KK-NTPKF-7M3Q4-QYBHW-6M%f%T9B__16_OutlookVolume_-OutlookRetail- @@ -14985,8 +15811,8 @@ function PrintLicensesInformation function vNextDiagRun { - $fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0) - $fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0) + $fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0) + $fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0) $rPID = $null -NE (GP "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext" -EA 0 | select -Expand 'property' -EA 0 | where -Filter {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}) $rSCA = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0) $rSCL = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0) @@ -15253,7 +16079,7 @@ function clcGetExpireSys return $null } - $rData = [DateTime]::FromFileTimeUTC($kuser).ToString('yyyy/MM/dd:HH:mm:ss') + $rData = [DateTime]::FromFileTimeUtc($kuser).ToString('yyyy/MM/dd:HH:mm:ss') return $rData } @@ -15535,7 +16361,7 @@ if %_erl%==5 goto:retokens if %_erl%==4 goto:fixwmi if %_erl%==3 goto:sfcscan if %_erl%==2 goto:dism_rest -if %_erl%==1 start %mas%troubleshoot.html &goto at_menu +if %_erl%==1 (start %selfgit% & start %github% & start %mas%troubleshoot & goto at_menu) goto :at_menu ::======================================================================================================================================== @@ -15881,7 +16707,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof if %winbuild% LSS 9200 if not defined _vis ( REM Fix issues caused by Update KB971033 in Windows 7 -REM https://support.microsoft.com/help/4487266 +REM https://support.microsoft.com/en-us/help/4487266 echo: echo Checking Update KB971033... %psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul% @@ -16022,12 +16848,12 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=") reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=") -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe) @@ -16326,7 +17152,7 @@ goto :at_menu :: https://stackoverflow.com/a/46268232 -set "ddf="%SystemRoot%\Temp\ddf"" +set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%"" %nul% del /q /f %ddf% echo/.New Cabinet>%ddf% echo/.set Cabinet=ON>>%ddf% @@ -16378,7 +17204,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -16424,7 +17250,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') { } # Fix perms for SPP in HKU\S-1-5-20 -# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +# https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') { exit @@ -16642,8 +17468,7 @@ if not defined allapps ( %eline% echo Failed to find activation IDs. Aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -16665,8 +17490,7 @@ if not defined osedition ( %eline% echo Failed to detect OS edition, aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -17465,15 +18289,6 @@ echo: echo Initializing... echo: -if not exist %SysPath%\sppsvc.exe ( -%eline% -echo [%SysPath%\sppsvc.exe] file is missing. Aborting... -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" -goto dk_done -) - ::======================================================================================================================================== set spp=SoftwareLicensingProduct @@ -17507,8 +18322,7 @@ if %osedition%==0 ( %eline% echo Failed to detect OS Edition. Aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -17557,6 +18371,7 @@ _updch _lang _clversion _version +_AudienceData _oIds _c2rXml _c2rExe @@ -17944,8 +18759,40 @@ set errorcode=%errorlevel% timeout /t 10 %nul% echo: +set suggestchannel= + if %errorcode% EQU 0 ( -call :dk_color %Gray% "Now run the Office activation option from the main menu." +if %change%==1 ( +echo %targetedition% | find /i "2019Volume" %nul% && ( +if not defined ltsc19 set suggestchannel=Production::LTSC +if /i not %_AudienceData%==Production::LTSC set suggestchannel=Production::LTSC +if /i not %_updch%==F2E724C1-748F-4B47-8FB8-8E0D210E9208 set suggestchannel=Production::LTSC +) + +echo %targetedition% | find /i "2021Volume" %nul% && ( +if not defined ltsc21 set suggestchannel=Production::LTSC2021 +if /i not %_AudienceData%==Production::LTSC2021 set suggestchannel=Production::LTSC2021 +if /i not %_updch%==5030841D-C919-4594-8D2D-84AE4F96E58E set suggestchannel=Production::LTSC2021 +) + +echo %targetedition% | find /i "2024Volume" %nul% && ( +if not defined ltsc24 set suggestchannel=Production::LTSC2024 +if /i not %_AudienceData%==Production::LTSC2024 set suggestchannel=Production::LTSC2024 +if /i not %_updch%==7983BAC0-E531-40CF-BE00-FD24FE66619C set suggestchannel=Production::LTSC2024 +) + +echo %targetedition% | findstr /R "20.*Volume" %nul% || ( +if defined ltscfound set suggestchannel=Production::CC +echo %_AudienceData% | find /i "LTSC" %nul% && set suggestchannel=Production::CC +) + +if defined suggestchannel ( +call :dk_color %Gray% "Mismatch found in update channel and installed product." +call :dk_color %Blue% "It is recommended to change the update channel to [!suggestchannel!] from the previous menu." +) +echo: +) +call :dk_color %Gray% "To activate Office, run the activation option from the main menu." ) else ( set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -18122,6 +18969,12 @@ echo Installed Office editions: %_oIds% echo Unsupported Office edition is installed on your Windows build version %winbuild%. goto :oe_goback ) +if defined ltscfound ( +%eline% +echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24% +echo Unsupported Office update channel is installed on your Windows build version %winbuild%. +goto :oe_goback +) ) ::=============== @@ -18130,49 +18983,52 @@ set inpt= set counter=0 set verified=0 set targetFFN= +set bypassFFN= set targetchannel= %line% echo: call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%" -call :dk_color %Gray% "Unsupported update channels are excluded from this list." +call :dk_color %Gray% "Installed Office editions: %_oIds%" %line% echo: for %%# in ( -"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain" -"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC" -"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC" -"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC" -"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC" -"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC" -"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain" -"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain" -"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC" -"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC" -"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021" -"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021" -"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024" -"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024" +"5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -" +"64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -" +"492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -" +"55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -" +"b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -" +"7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -" +"ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -" +"b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -" +"f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -" +"1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -" +"5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -" +"86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -" +"7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -" +"c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -" ) do ( for /f "tokens=1-2 delims=_" %%A in ("%%~#") do ( +set bypass= set supported= if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1) if %winbuild% GEQ 10240 ( -if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported= -if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported= -if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported= -if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported= +if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set bypass=1 +if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1 +if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1 +if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1 ) if defined supported ( set /a counter+=1 if !counter! LSS 10 ( -echo [!counter!] %%B +if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B) ) else ( -echo [!counter!] %%B +if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B) ) set targetFFN!counter!=%%A set targetchannel!counter!=%%B +if defined bypass set bypassFFN=!bypassFFN!%%A ) ) ) @@ -18186,7 +19042,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En set /p inpt= if "%inpt%"=="" goto :oe_changeupdchnl if "%inpt%"=="0" goto :oemenu -if /i "%inpt%"=="R" start https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl +if /i "%inpt%"=="R" start https://learn.microsoft.com/en-us/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1) set targetFFN=!targetFFN%inpt%! set targetchannel=!targetchannel%inpt%! @@ -18203,15 +19059,133 @@ set build= for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a) echo "%build%" | find /i "16." %nul% || set build= +echo: +for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A) +echo Target build number: %build% +echo: %bypassFFN% | find /i "%targetFFN%" %nul% && goto :oe_changeunoff + +call :oe_cleanupreg + +if not defined build ( +if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN." +set "updcommand="%_c2rCexe%" /update user" +) else ( +set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%" +) +echo Running the below command to trigger updates... +echo: +echo %updcommand% +%updcommand% +echo: +echo Check this webpage for help - %mas%troubleshoot +goto :oe_goback + +::======================= + +:: Unofficial method to change channel + +:oe_changeunoff + +set abortchange= +echo %targetchannel% | find /i "2019 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2019Volume" %nul% || set abortchange=1)) +echo %targetchannel% | find /i "2021 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2021Volume" %nul% || set abortchange=1)) +echo %targetchannel% | find /i "2024 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2024Volume" %nul% || set abortchange=1)) + +if defined abortchange ( +%eline% +echo Mismatch found in installed Office products and target update channel. Aborting... +echo Non-perpetual Office products are not suppported with Perpetual VL update channels. +goto :oe_goback +) + +if not defined build ( +%eline% +call :dk_color %Red% "Failed to detect build number for the target FFN." +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +goto :oe_goback +) + +set buildchk=0 +for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a" + +set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" +set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE" + +if %clverchk% LSS %buildchk% ( +echo: +call :dk_color %Blue% "Do not terminate the operation before it completes..." +echo: +echo Updating Office C2R client with the command below, please wait... +echo: +echo %c2rclientupdate% +%c2rclientupdate% +for /l %%i in (1,1,30) do (if !clverchk! LSS %buildchk% (call :ch_getinfo&timeout /t 10 %nul%)) +) + +if %clverchk% LSS %buildchk% ( +echo: +call :dk_color %Red% "Failed to update Office C2R client. Aborting..." +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +goto :oe_goback +) + +call :oe_cleanupreg + +echo Running the below command to change update channel, please wait... +echo: +echo %c2rcommand% +%c2rcommand% +set errorcode=%errorlevel% +timeout /t 10 %nul% + +echo: +if %errorcode% EQU 0 ( +call :dk_color %Gray% "Now run the Office activation option from the main menu." +) else ( +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) + +::======================================================================================================================================== + +:oe_goback + +call :oe_tempcleanup + +echo: +if defined fixes ( +call :dk_color %White% "Follow ALL the ABOVE blue lines. " +call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" +choice /C:10 /N +if !errorlevel!==2 goto :oemenu +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) +) + +if defined terminal ( +call :dk_color %_Yellow% "Press [0] key to go back..." +choice /c 0 /n +) else ( +call :dk_color %_Yellow% "Press any key to go back..." +pause %nul1% +) +goto :oemenu + +::======================================================================================================================================== + +:oe_cleanupreg + :: Cleanup Office update related registries, thanks to @abbodi1406 :: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813 :: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels -echo: -for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A) echo: echo Cleaning Office update registry keys... echo Adding new update channel to registry keys... +echo: %nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f %nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f @@ -18228,42 +19202,7 @@ echo Adding new update channel to registry keys... %nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32 %nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f -if not defined build ( -if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN." -set "updcommand="%_c2rCexe%" /update user" -) else ( -set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%" -) -echo Running the below command to trigger updates... -echo: -echo %updcommand% -%updcommand% -echo: -echo Check this webpage for help - %mas%troubleshoot -goto :oe_goback - -::======================================================================================================================================== - -:oe_goback - -call :oe_tempcleanup - -echo: -if defined fixes ( -call :dk_color %White% "Follow ALL the ABOVE blue lines. " -call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" -choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) -) - -if defined terminal ( -call :dk_color %_Yellow% "Press [0] key to go back..." -choice /c 0 /n -) else ( -call :dk_color %_Yellow% "Press any key to go back..." -pause %nul1% -) -goto :oemenu +exit /b ::======================================================================================================================================== @@ -18286,6 +19225,7 @@ set _oRoot= set _oArch= set _updch= set _oIds= +set _firstoId= set _lang= set _cfolder= set _version= @@ -18316,9 +19256,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a") ) set _oIds=%_oIds:.16=% +for /f "tokens=1" %%A in ("%_oIds%") do set _firstoId=%%A +for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v %_firstoId%.ExcludedApps" %nul6%') do (set "_firstoIdExcludelist=%%b") set verchk=0 +set clverchk=0 for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a" +for /f "tokens=3 delims=." %%a in ("%_clversion%") do set "clverchk=%%a" if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" @@ -18334,16 +19278,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" ( set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe" ) -set "audidata4=%_AudienceData:~-4%" +:: Check LTSC version files -if /i "%audidata4%"=="LTSC" set ltsc19=LTSC -echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC - -if /i "%audidata4%"=="2021" set ltsc21=LTSC2021 -echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 - -if /i "%audidata4%"=="2024" set ltsc24=LTSC2024 -:: LTSC 2024 build is not fixed yet +for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do ( +echo "%%b" %nul2% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC +echo "%%b" %nul2% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 +echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024 +) if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1 diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 340c2a8..3224434 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -100,6 +100,8 @@ set "nul=" set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -239,12 +241,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -274,7 +278,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -356,7 +366,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -381,11 +391,13 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) ) @@ -1103,7 +1115,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1169,7 +1181,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -1308,7 +1320,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -1379,10 +1391,12 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) if %_wmic% EQU 1 wmic path %sps% get Version %nul% @@ -1577,7 +1591,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -1702,7 +1716,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 3f99aee..3e9e4d5 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -103,6 +103,8 @@ set "nul=" set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -242,12 +244,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -277,7 +281,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -359,7 +369,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) cls @@ -421,11 +431,13 @@ if defined _fmiss ( %eline% echo [%_fmiss%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -1201,7 +1213,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1312,7 +1324,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -1451,7 +1463,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -1522,10 +1534,12 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) if %_wmic% EQU 1 wmic path %sps% get Version %nul% @@ -1720,7 +1734,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -1845,7 +1859,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index ca9a308..93b5c80 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -100,6 +100,8 @@ set "nul=" set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -183,15 +185,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto dk_done ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto dk_done ) @@ -247,12 +249,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -282,7 +286,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -364,7 +374,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) cls @@ -427,11 +437,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -527,7 +539,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You only have the Office dashboard app installed, you need to install the full version of Office. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) echo: call :dk_color %Blue% "Download and install Office from the below URL and then try again." @@ -602,6 +614,7 @@ set error=1 goto :starto16c2r ) +call :oh_expiredpreview 2013 call :oh_fixprids call :oh_process if defined isOspp ( @@ -659,6 +672,7 @@ set error=1 goto :startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 call :oh_fixprids call :oh_process if defined isOspp ( @@ -669,12 +683,12 @@ call :oh_hookinstall ::======================================================================================================================================== -:: Old version (16.0.9xxxx and below) of Office with subscription license key may show a banner to sign in to fix license issue. +:: Old version of Office with subscription license key may show a banner to sign in to fix license issue. :: Although script applies a Resiliency registry entry to fix that but it doesn't work on old office versions. :: Below code checks that condition and informs the user to update the Office. if defined _sublic ( -if not exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( +if not exist "%_oLPath%\Word2021VL_KMS_Client_AE*.xrm-ms" ( call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Office, otherwise, it may show a licensing issue-related banner.]" ) ) @@ -907,12 +921,27 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" % for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) + +exit /b + +::======================================================================================================================================== + +:oh_expiredpreview + +for %%# in (%*) do ( +if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" ( +set error=1 +set showfix=1 +call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]" +call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again." +) +) exit /b @@ -1354,7 +1383,7 @@ exit /b :oh_clearblock :: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing -:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state +:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state set _sidlist= for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a)) @@ -1450,12 +1479,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share ) :: Clear device-based-licensing -:: https://learn.microsoft.com/deployoffice/device-based-licensing +:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul% :: Remove OEM registry key -:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 +:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 for %%# in (15 16) do ( reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul% @@ -1699,9 +1728,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( set len=0 -echo:!allapps!> %SystemRoot%\Temp\chklen -for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) -del %SystemRoot%\Temp\chklen %nul% +echo:!allapps!> "!_ttemp!\chklen" +for %%A in ("!_ttemp!\chklen") do (set len=%%~zA) +del "!_ttemp!\chklen" %nul% if !len! GTR 6000 ( %eline% @@ -1779,7 +1808,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1830,7 +1859,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -1969,7 +1998,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -2040,10 +2069,12 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) if %_wmic% EQU 1 wmic path %sps% get Version %nul% @@ -2238,7 +2269,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -2363,7 +2394,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( @@ -2396,7 +2428,6 @@ exit /b 14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR 14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR 14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR] -14_98677603-a668-4fa4-9980-3f1f05f78f69_Retail________PublisherR 14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR] 14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR] @@ -2434,6 +2465,7 @@ for %%# in ( 14_11b39439-6b93-4642-9570-f2eb81be2238_4DTT4-D4MKX-23KFH-JKR6T-YK%f%G2J_MAK___________ProjectStdVL 14_71af7e84-93e6-4363-9b69-699e04e74071_2J9H6-H4D3G-PCXD2-96XVM-TR%f%R73_Retail________ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] 14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_6CD6C-9R8PB-T2D9Y-8RKKX-W7%f%DFK_MAK___________ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_CTRJP-P72VV-JBF8Y-4W6WW-HX%f%HVG_Retail________PublisherR 14_3d014759-b128-4466-9018-e80f6320d9d0_32YG9-3VX77-YXJVV-PRVFW-TT%f%8BV_MAK___________PublisherVL 14_8090771e-d41a-4482-929e-de87f1f47e46_7VKXH-9BWCG-RPTBB-JBRV3-GR%f%HYC_MAK___________SmallBusBasicsVL 14_b78df69e-0966-40b1-ae85-30a5134dedd0_H48K6-FB4Y6-P83GH-9J7XG-HD%f%KKX_ByPass________SPDR @@ -2498,6 +2530,7 @@ for %%# in ( 15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail 15_0bc1dae4-6158-4a1c-a893-807665b934b2_2QCNB-RMDKJ-GC8PB-7QGQV-7Q%f%TQJ_Subscription2_O365SmallBusPremRetail :: Office 365 - 16.0 version +16_dabaa1f2-109b-496d-bf49-1536cc862900_3HYJN-9KG99-F8VG9-V3DT8-JF%f%MHV_Subscription__O365AppsBasicRetail 16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail 16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W62NQ-267QR-RTF74-PF2MH-JQ%f%MTH_Subscription__O365EduCloudRetail 16_a96f8dae-da54-4fad-bdc6-108da592707a_3NMDC-G7C3W-68RGP-CB4MH-4C%f%XCH_SubTest1______O365HomePremRetail diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index bb6fd92..eb43119 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -125,6 +125,8 @@ set "nul=" set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -214,15 +216,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto dk_done ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto dk_done ) @@ -278,12 +280,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -313,7 +317,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -395,7 +405,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -489,11 +499,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -772,7 +784,7 @@ call :dk_color %Red% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You have only Office dashboard app installed, you need to install full Office version. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) call :dk_color %Blue% "Download and install Office from below URL and try again." set fixes=%fixes% %mas%genuine-installation-media @@ -864,6 +876,7 @@ set error=1 goto :ks_starto16c2r ) +call :oh_expiredpreview 2013 if "%_actprojvis%"=="0" call :oh_fixprids call :ks_process @@ -904,6 +917,7 @@ set error=1 goto :ks_startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 if "%_actprojvis%"=="0" call :oh_fixprids call :ks_process @@ -929,7 +943,7 @@ call :oh_licrefresh :ks_activate :: Opt out of sending KMSclient activation data to Microsoft -:: https://learn.microsoft.com/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform +:: https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform if %winbuild% GEQ 9600 ( reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f %nul% @@ -997,7 +1011,7 @@ echo Cleared %KS% Server from the registry. ) ) -:: https://learn.microsoft.com/azure/virtual-desktop/windows-10-multisession-faq +:: https://learn.microsoft.com/en-us/azure/virtual-desktop/windows-10-multisession-faq if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# ( call :dk_color %Red% "%winos% does not support activation on non-azure platforms." @@ -1073,12 +1087,27 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" % for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) + +exit /b + +::======================================================================================================================================== + +:oh_expiredpreview + +for %%# in (%*) do ( +if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" ( +set error=1 +set showfix=1 +call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]" +call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again." +) +) exit /b @@ -1210,6 +1239,10 @@ call :ksdata getinfo !_prod! if defined _altoffid ( set _License=!_altoffid! echo Converting Retail To Volume [!_prod! To !_altoffid!] +echo %%# | find /i "O365" %nul% && ( +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") +) set _prod=!_altoffid! call :ks_osppready ) @@ -1225,7 +1258,7 @@ call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 ! call :dk_color %Blue% "Make sure you are using Latest MAS script." ) else ( call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]" -call :dk_color %Blue% "Use Ohook option to activate it." +call :dk_color %Blue% "Use Ohook option to activate it. To activate with %KS%, you need to install Volume version of Office." ) set fixes=%fixes% %mas%genuine-installation-media call :dk_color %_Yellow% "%mas%genuine-installation-media" @@ -1328,7 +1361,7 @@ exit /b :oh_clearblock :: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing -:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state +:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state set _sidlist= for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a)) @@ -1424,12 +1457,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share ) :: Clear device-based-licensing -:: https://learn.microsoft.com/deployoffice/device-based-licensing +:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul% :: Remove OEM registry key -:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 +:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 for %%# in (15 16) do ( reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul% @@ -2121,8 +2154,8 @@ set srvlist= set -= set "srvlist=kms.03%-%k.org kms-default.cangs%-%hui.net kms.six%-%yin.com kms.moe%-%club.org kms.cgt%-%soft.com" -set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.my%-%ds.cloud" -set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%pym.com" +set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.mc%-%06.net" +set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%xi.com" set n=1 for %%a in (%srvlist%) do (set %%a=&set server!n!=%%a&set /a n+=1) @@ -2673,9 +2706,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( set len=0 -echo:!allapps!> %SystemRoot%\Temp\chklen -for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) -del %SystemRoot%\Temp\chklen %nul% +echo:!allapps!> "!_ttemp!\chklen" +for %%A in ("!_ttemp!\chklen") do (set len=%%~zA) +del "!_ttemp!\chklen" %nul% if !len! GTR 6000 ( %eline% @@ -2771,7 +2804,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -2882,7 +2915,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -3021,7 +3054,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -3092,10 +3125,12 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) if %_wmic% EQU 1 wmic path %sps% get Version %nul% @@ -3290,7 +3325,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -3415,7 +3450,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( @@ -3805,7 +3841,7 @@ d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3_6Q7VD-NX8JD-WJ2VH-88V73-4G%f%BJ7__15_WordVo 67c0fc0c-deba-401b-bf8b-9c8ad8395804_GNH9Y-D2J4T-FJHGG-QRVH7-QP%f%FDW__16_AccessVolume_-AccessRetail- c3e65d36-141f-4d2f-a303-a842ee756a29_9C2PK-NWTVB-JMPW8-BFT28-7F%f%TBF__16_ExcelVolume_-ExcelRetail- e914ea6e-a5fa-4439-a394-a9bb3293ca09_DMTCJ-KNRKX-26982-JYCKT-P7%f%KB6__16_MondoRetail -9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce_HFTND-W9MK4-8B7MJ-B6C4G-XQ%f%BR2__16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- 436366de-5579-4f24-96db-3893e4400030_XYNTG-R96FY-369HX-YFPHY-F9%f%CPM__16_OneNoteFreeRetail_[Bypass] d8cace59-33d2-4ac7-9b1b-9b72339c51c8_DR92N-9HTF2-97XKM-XW2WJ-XW%f%3J6__16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail- ec9d9265-9d1e-4ed0-838a-cdc20f2551a1_R69KK-NTPKF-7M3Q4-QYBHW-6M%f%T9B__16_OutlookVolume_-OutlookRetail- diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 40d9914..27307cb 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -45,6 +45,11 @@ set tsids= :: To reset rearm counter, evaluation period and clear the tamper state, key lock, run the script with "/Z-Reset" parameter or change 0 to 1 in below line set _resall=0 +:: Choose activation method: +:: In builds 19041 and later, the script will auto select StaticCID (requires internet). If no internet is detected, it will then auto select the KMS4k method. For builds lower than 19041, the script will auto select ZeroCID. +:: To change the activation method, run the script with the parameters "/Z-SCID", "/Z-ZCID", or "/Z-KMS4k", or modify the option from Auto to SCID, ZCID, or KMS4k in the line below. +set _actmethod=Auto + :: Debug Mode: :: To run the script in debug mode, change 0 to any parameter above that you want to run, in below line set "_debug=0" @@ -129,6 +134,8 @@ set "nul=" set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -189,10 +196,14 @@ if /i "%%A"=="/Z-OffHost" (set _actoffhost=1) if /i "%%A"=="/Z-APPX" (set _actappx=1) echo "%%A" | find /i "/Z-ID-" >nul && (set _actman=1& set "filtsids=%%A" & call set "filtsids=%%filtsids:~6%%" & if defined filtsids call set tsids=%%filtsids%% %%tsids%%) if /i "%%A"=="/Z-Reset" (set _resall=1) +if /i "%%A"=="/Z-SCID" (set _actmethod=SCID) +if /i "%%A"=="/Z-ZCID" (set _actmethod=ZCID) +if /i "%%A"=="/Z-KMS4k" (set _actmethod=KMS4k) ) if not defined tsids set _actman=0 for %%A in (%_actwin% %_actesu% %_actoff% %_actprojvis% %_actwinesuoff% %_actwinhost% %_actoffhost% %_actappx% %_actman% %_resall%) do (if "%%A"=="1" set _unattended=1) +if /i not %_actmethod%==Auto set _unattended=1 ::======================================================================================================================================== @@ -220,15 +231,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto dk_done ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto dk_done ) @@ -238,8 +249,8 @@ reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul echo .NET 3.5 Framework is not installed in your system. echo Install it using the following URL. echo: -echo https://www.microsoft.com/download/details.aspx?id=25150 -if %_unattended%==0 start https://www.microsoft.com/download/details.aspx?id=25150 +echo https://www.microsoft.com/en-us/download/details.aspx?id=25150 +if %_unattended%==0 start https://www.microsoft.com/en-us/download/details.aspx?id=25150 goto dk_done ) ) @@ -296,12 +307,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -331,7 +344,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -413,7 +432,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -449,6 +468,7 @@ echo [E] Reset - Rearm/Timers ) else ( echo [E] Reset - Rearm/Timers/Tamper/Lock ) +echo [F] Change - Activation Method [%_actmethod%] echo _______________________________________________ echo: echo [6] Remove TSforge Activation @@ -457,12 +477,13 @@ echo [0] %_exitmsg% echo ______________________________________________________________ echo: call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard..." -choice /C:12345ABCDE670 /N +choice /C:12345ABCDEF670 /N set _el=!errorlevel! -if !_el!==13 exit /b -if !_el!==12 start %mas%genuine-installation-media & goto :ts_menu -if !_el!==11 call :ts_remove & cls & goto :ts_menu +if !_el!==14 exit /b +if !_el!==13 start %mas%genuine-installation-media & goto :ts_menu +if !_el!==12 call :ts_remove & cls & goto :ts_menu +if !_el!==11 goto :ts_changemethod if !_el!==10 cls & setlocal & set "_resall=1" & call :ts_start & endlocal & cls & goto :ts_menu if !_el!==9 cls & setlocal & set "_actman=1" & call :ts_start & endlocal & cls & goto :ts_menu if !_el!==8 cls & setlocal & set "_actappx=1" & call :ts_start & endlocal & cls & goto :ts_menu @@ -476,6 +497,57 @@ if !_el!==1 cls & setlocal & set "_actwin=1" & call :ts_start & endlocal goto :ts_menu ) +goto :ts_start + +::======================================================================================================================================== + +:ts_changemethod + +cls +if not defined terminal mode 76, 36 + +echo: +echo: +echo: +echo ______________________________________________________________ +echo: +call :dk_color2 %_White% " [1] " %_Green% "Auto" +echo Builds ^>= 19041 - StaticCID (KMS4k if offline) +echo Builds ^< 19041 - ZeroCID +echo __________________________________________________ +echo: +echo [2] StaticCID +echo Needs Internet +echo Not for Windows 7 or older +echo __________________________________________________ +echo: +echo [3] ZeroCID +echo Works reliably on builds below 19041 +echo May break on builds between 19041-26100 +echo Does not work on builds above 26100.4188 +echo __________________________________________________ +echo: +echo [4] KMS4k +echo Volume licenses only +echo Activates for 4000+ years +echo __________________________________________________ +echo: +echo [5] Learn More +echo [0] %_exitmsg% +echo ______________________________________________________________ +echo: +call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard..." +choice /C:123450 /N +set _el=!errorlevel! + +if !_el!==6 goto :ts_menu +if !_el!==5 cls & start %mas%tsforge &goto :ts_menu +if !_el!==4 cls & set "_actmethod=KMS4k" & goto :ts_menu +if !_el!==3 cls & set "_actmethod=ZCID" & goto :ts_menu +if !_el!==2 cls & set "_actmethod=SCID" & goto :ts_menu +if !_el!==1 cls & set "_actmethod=Auto" & goto :ts_menu +goto :ts_changemethod + ::======================================================================================================================================== :ts_start @@ -498,11 +570,13 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +if not defined results ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options." call :dk_color %Blue% "After that, restart system and try activation again." echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) goto dk_done ) @@ -556,6 +630,57 @@ cls echo: call :dk_showosinfo +if /i %_actmethod%==SCID set tsmethod=StaticCID +if /i %_actmethod%==ZCID set tsmethod=ZeroCID +if /i %_actmethod%==KMS4k set tsmethod=KMS4k + +if /i %_actmethod%==Auto ( +if %winbuild% GEQ 19041 ( +set tsmethod=StaticCID +) else ( +set tsmethod=ZeroCID +) +) + +if %winbuild% LSS 9200 if /i %tsmethod%==StaticCID ( +%eline% +echo StaticCID method is supported only on Windows 8 and later. +goto dk_done +) + +::======================================================================================================================================== + +:: Check Internet connection + +if /i %tsmethod%==StaticCID ( +set _int= +for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int ( +for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not "%%#"=="" set _int=1) +) + +if not defined _int ( +%psc% "If([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet){Exit 0}Else{Exit 1}" +if !errorlevel!==0 (set _int=1&set ping_f= But Ping Failed) +) + +if defined _int ( +echo Checking Internet Connection [Connected!ping_f!] +) else ( +if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k +if /i !tsmethod!==KMS4k ( +call :dk_color %Gray% "Checking Internet Connection [Not Connected]" +call :dk_color %Blue% "Switching To KMS4k Activation Method because Internet is needed for StaticCID method." +) else ( +set error=1 +call :dk_color %Red% "Checking Internet Connection [Not Connected]" +call :dk_color %Blue% "Internet is required for TSforge StaticCID option." +) +echo: +) +) + +::======================================================================================================================================== + echo Initiating Diagnostic Tests... set "_serv=%_slser% Winmgmt" @@ -573,6 +698,11 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto :dk_done ) +if /i !tsmethod!==KMS4k ( +call :_taskclear-cache +echo Clearing %KS% Cache [Successful] +) + ::======================================================================================================================================== if %_resall%==1 goto :ts_resetall @@ -594,16 +724,23 @@ echo %tsedition% | find /i "Eval" %nul1% && ( goto :ts_wineval ) -call :ts_checkwinperm +set /a UBR=0 +if %winbuild% EQU 26100 ( +for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b +if !UBR! LSS 4188 (set dontcheckact=1) +) + +if not defined dontcheckact call :ts_checkwinperm if defined _perm ( call :dk_color %Gray% "Checking OS Activation [Windows is already permanently activated]" goto :ts_esu ) +if %winbuild% LSS 9200 if /i %tsmethod%==KMS4k goto :ts_oldks if defined _vis goto :ts_winvista set tempid= -set keytype=zero +if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -613,6 +750,13 @@ echo Checking Activation ID [%tempid%] [%tsedition%] ) else ( call :dk_color %Red% "Checking Activation ID [Not Found] [%tsedition%] [%osSKU%]" set error=1 +if /i %tsmethod%==KMS4k ( +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +) goto :ts_esu ) @@ -620,6 +764,83 @@ if defined winsub ( call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]." echo: ) + +goto :ts_esu + +::======================================================================================================================================== + +:ts_oldks + +:: KMS keys for KMS4k method because TSforge cannot install KMS key on Windows Vista and 7 + +:: 1st column = Activation ID +:: 2nd column = Generic key +:: 3rd column = Edition ID +:: Separator = _ + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: Windows 7 +ae2ee509-1b34-41c0-acb7-6d4650168915_33PXH-7Y6KF-2VJC9-XBBR8-HV%f%THH_Enterprise +1cb6d605-11b3-4e14-bb30-da91c8e3983a_YDRBP-3D83W-TY26F-D46B2-XC%f%KRJ_EnterpriseN +b92e9980-b9d5-4821-9c94-140f632f6312_FJ82H-XT6CR-J8D7P-XQJJ2-GP%f%DD4_Professional +54a09a0d-d57b-4c10-8b69-a842d6590ad5_MRPKT-YTG23-K7D7T-X2JMM-QY%f%7MG_ProfessionalN +db537896-376f-48ae-a492-53d0547773d0_YBYF6-BHCR3-JPKRB-CDW7B-F9%f%BK4_Embedded_POSReady +aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395_73KQT-CD9G6-K7TQG-66MRP-CQ%f%22C_Embedded_ThinPC +5a041529-fef8-4d07-b06f-b59b573b32d2_W82YF-2Q76Y-63HXB-FGJG9-GF%f%7QX_ProfessionalE +46bbed08-9c7b-48fc-a614-95250573f4ea_C29WB-22CC8-VJ326-GHFJW-H9%f%DH4_EnterpriseE +:: Windows Server 2008 R2 +68531fb9-5511-4989-97be-d11a0f55633f_YC6KT-GKW9T-YTKYR-T4X34-R7%f%VHC_ServerStandard +7482e61b-c589-4b7f-8ecc-46d455ac3b87_74YFP-3QFB3-KQT8W-PMXWJ-7M%f%648_ServerDatacenter +620e2b3d-09e7-42fd-802a-17a13652fe7a_489J6-VHDMP-X63PK-3K798-CP%f%X3Y_ServerEnterprise +7482e61b-c589-4b7f-8ecc-46d455ac3b87_74YFP-3QFB3-KQT8W-PMXWJ-7M%f%648_ServerDatacenterCore +68531fb9-5511-4989-97be-d11a0f55633f_YC6KT-GKW9T-YTKYR-T4X34-R7%f%VHC_ServerStandardCore +620e2b3d-09e7-42fd-802a-17a13652fe7a_489J6-VHDMP-X63PK-3K798-CP%f%X3Y_ServerEnterpriseCore +8a26851c-1c7e-48d3-a687-fbca9b9ac16b_GT63C-RJFQ3-4GMB6-BRFB9-CB%f%83V_ServerEnterpriseIA64 +a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4_ServerWeb +cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX_ServerHPC +a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4_ServerWebCore +f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K_ServerEmbeddedSolution +:: Windows Vista +cfd8ff08-c0d7-452b-9f60-ef5c70c32094_VKK3X-68KWM-X2YGT-QR4M6-4B%f%WMV_Enterprise +4f3d1606-3fea-4c01-be3c-8d671c401e3b_YFKBB-PQJJV-G996G-VWGXY-2V%f%3X8_Business +2c682dc2-8b68-4f63-a165-ae291d4cf138_HMBQG-8H2RH-C77VX-27R82-VM%f%QBT_BusinessN +d4f54950-26f2-4fb4-ba21-ffab16afcade_VTC42-BM838-43QHV-84HX6-XJ%f%XKV_EnterpriseN +:: Windows Server 2008 +ad2542d4-9154-4c6d-8a44-30f11ee96989_TM24T-X9RMF-VWXK6-X8JC9-BF%f%GM2_ServerStandard +68b6e220-cf09-466b-92d3-45cd964b9509_7M67G-PC374-GR742-YH8V4-TC%f%BY3_ServerDatacenter +c1af4d90-d1bc-44ca-85d4-003ba33db3b9_YQGMW-MPWTJ-34KDK-48M3W-X4%f%Q6V_ServerEnterprise +01ef176b-3e0d-422a-b4f8-4ea880035e8f_4DWFP-JF3DJ-B7DTH-78FJB-PD%f%RHK_ServerEnterpriseIA64 +ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b_WYR28-R7TFJ-3X2YQ-YCY4H-M2%f%49D_ServerWeb +7afb1156-2c1d-40fc-b260-aab7442b62fe_RCTX3-KWVHP-BR6TB-RB6DM-6X%f%7HP_ServerComputeCluster +2401e3d0-c50a-4b58-87b2-7e794b7d2607_W7VD6-7JFBR-RX26B-YKQ3Y-6F%f%FFJ_ServerStandardV +fd09ef77-5647-4eff-809c-af2b64659a45_22XQ2-VRXRG-P8D42-K34TD-G3%f%QQC_ServerDatacenterV +8198490a-add0-47b2-b3ba-316b12d647b4_39BXF-X8Q23-P2WWT-38T2F-G3%f%FPG_ServerEnterpriseV +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do if %tsedition%==%%C if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) + +if not defined key ( +call :dk_color %Red% "Checking Activation ID [%tsedition% SKU-%osSKU% %KS% key is not available]" +call :dk_color %Blue% "Use ZeroCID activation method from the previous menu." +goto :ts_esu +) + +echo Checking Activation ID [%tempid%] [%tsedition%] + +set oldks=1 +set generickey=1 +call :dk_inskey "[%key%]" +set tsids=%tsids% %tempid% goto :ts_esu ::======================================================================================================================================== @@ -700,7 +921,7 @@ echo Checking Activation ID [%tempid%] [%tsedition%] set generickey=1 call :dk_inskey "[%key%]" -if not defined error set tsids=%tsids% %tempid% +set tsids=%tsids% %tempid% goto :ts_esu ::======================================================================================================================================== @@ -829,6 +1050,15 @@ call :dk_inskey "[%key%]" :ts_esu if not %_actesu%==1 goto :ts_off +if /i %tsmethod%==KMS4k ( +call :dk_color %Red% "Skipping Windows ESU [KMS4k method is not supported with Windows ESU]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_off +) :: Process Windows ESU @@ -902,7 +1132,8 @@ goto :ts_off if defined esuexistsup ( echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && ( echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || ( -call :dk_color %Gray% "Now update Windows to get Client-ESU-Year6[4-6y] license and activate that using this script." +call :dk_color %Gray% "To get Client-ESU-Year6[4-6y] license, install updates from the below URL." +call :dk_color %Blue% "%mas%tsforge#windows-esu" ) ) goto :ts_off @@ -915,8 +1146,12 @@ goto :ts_off if defined esuexistbutnosup ( call :dk_color %Red% "Checking Activation ID [Commercial ESU is not supported for %tsedition%]" +echo %esueditionlist% | find /i "Professional" %nul1% && ( +call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option, and change it to [Professional] or any non-Home edition." +) || ( call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions." echo [%esueditionlist%] +) goto :ts_off ) @@ -977,8 +1212,8 @@ set o14c2r= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o14msi=Office 2010 MSI ) %nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R @@ -1041,7 +1276,7 @@ call :dk_color %Gray% "Checking Installed Office [Not Found]" if defined ohub ( echo: -echo You have only Office dashboard app installed, you need to install full Office version. +echo You only have the Office Dashboard app installed. You need to install the full version of Office. ) call :dk_color %Blue% "Download and install Office from below URL and try again." if %_actwin%==0 set fixes=%fixes% %mas%genuine-installation-media @@ -1145,6 +1380,7 @@ set error=1 goto :ts_starto16c2r ) +call :oh_expiredpreview 2013 if "%_actprojvis%"=="0" call :oh_fixprids call :ts_process @@ -1186,11 +1422,30 @@ set error=1 goto :ts_startmsi ) +call :oh_expiredpreview 2016 2019 2021 2024 if "%_actprojvis%"=="0" call :oh_fixprids call :ts_process ::======================================================================================================================================== +:: mass grave[.]dev/office-license-is-not-genuine +:: Add registry keys for volume products so that 'non-genuine' banner won't appear + +set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" +if /i %tsmethod%==KMS4k ( +if %winbuild% GEQ 9200 ( +if not "%osarch%"=="x86" ( +reg delete "%kmskey%" /f /reg:32 %nul% +reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" /reg:32 %nul% +) +reg delete "%kmskey%" /f %nul% +reg add "%kmskey%" /f /v KeyManagementServiceName /t REG_SZ /d "10.0.0.10" %nul% +echo Adding a Registry to Prevent Banner [Successful] +) +) + +::======================================================================================================================================== + :ts_startmsi if defined o15msi call :ts_processmsi 15 %o15msi_reg% @@ -1214,6 +1469,17 @@ goto :ts_act echo: echo Processing Windows %KS% Host... +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Windows %KS% Host [KMS4k method is not supported with Windows %KS% Host]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_act +) + echo: if %winbuild% GEQ 10586 ( call :dk_color %Gray% "With %KS% Host license, system may randomly change Windows Edition later. It is a Windows issue and can be safely ignored." @@ -1307,7 +1573,7 @@ goto :ts_act ) call :dk_inskey "[%key%]" -if not defined error set tsids=%tsids% %tempid% +set tsids=%tsids% %tempid% goto :ts_act ::======================================================================================================================================== @@ -1325,6 +1591,17 @@ call :dk_color %Blue% "Windows Vista and Server 2008 do not support the installa goto :ts_act ) +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Office %KS% Host [KMS4k method is not supported with Office %KS% Host]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :ts_act +) + set ohostexist= call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 set ohostids=%allapps% @@ -1377,6 +1654,17 @@ call :dk_color %Gray% "Checking Activation ID [APPX Sideloading goto :dk_done ) +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Windows 8/8.1 APPX [KMS4k method is not supported with Windows 8/8.1 APPX]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :dk_done +) + set appxexist= if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f @@ -1435,6 +1723,17 @@ echo: echo Processing Manual Activation... echo: +if /i %tsmethod%==KMS4k ( +echo: +call :dk_color %Red% "Skipping Manual Activation [KMS4k method is not supported with it]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +goto :dk_done +) + call :dk_color %Gray% "This option is for advanced users, those who already know what they are doing." call :dk_color %Blue% "Some activation IDs may cause system crash [MUI mismatch], or irreversible changes [CloudEdition etc]." @@ -1594,12 +1893,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble if defined tsids ( echo: -if not defined _vis echo Installing Forged Product Key Data... -echo Depositing Zero Confirmation ID... +if not defined _vis if not defined oldks echo Installing Forged Product Key Data... +if /i %tsmethod%==KMS4k ( +echo Writing TrustedStore data... +) else ( +if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) +) echo: %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" if !errorlevel!==3 ( -if %_actman%==0 call :dk_color %Blue% "%_fixmsg%" +if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( @@ -1692,10 +1995,25 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" % for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) + +exit /b + +::======================================================================================================================================== + +:oh_expiredpreview + +for %%# in (%*) do ( +if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" ( +set error=1 +set showfix=1 +call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]" +call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again." +) +) exit /b @@ -1775,6 +2093,19 @@ set _preview= set _License=%%# set skipprocess= + +set foundprod= +call :tsksdata chkprod %%# +if defined _oMSI if not defined foundprod if /i %tsmethod%==KMS4k ( +set skipprocess=1 +call :dk_color %Red% "Checking Product In Script [%%# MSI Retail is not supported with KMS4k]" +if /i %_actmethod%==Auto ( +call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." +) else ( +call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." +) +) + if "%_actprojvis%"=="1" ( echo %%# | findstr /i "Project Visio" %nul% || ( set skipprocess=1 @@ -1782,8 +2113,17 @@ call :dk_color %Gray% "Skipping Because Project/Visio Mode [%%#]" ) ) +if "%_actprojvis%"=="0" if /i %tsmethod%==KMS4k echo %_oIds% | findstr /i "O365" %nul% && ( +echo %%# | findstr /i "Project Visio" %nul% && ( +set skipprocess=1 +echo Skipping Because Mondo Is Available [%%#] +) +) + + if not defined skipprocess ( +if /i not %tsmethod%==KMS4k ( set no365= if "%oVer%"=="15" (echo %%# | findstr /i "O365HomePremRetail" %nul% && set no365=1) if "%oVer%"=="16" (echo %%# | findstr /i "O365" %nul% && set no365=1) @@ -1793,6 +2133,8 @@ set _License=MondoRetail set _altoffid=MondoRetail call :ks_osppready echo Converting Unsupported O365 Office [%%# To MondoRetail] +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") ) if not defined _oMSI ( @@ -1803,8 +2145,30 @@ call :ks_osppready echo Converting Unsupported OEM-ARM Office [%%# To MondoRetail] ) ) +) +if not defined _oMSI if /i %tsmethod%==KMS4k if not defined foundprod ( +call :tsksdata getinfo %%# +if defined _altoffid ( +echo Converting Retail To Volume [%%# To !_altoffid!] +) else ( +set _License=MondoVolume +set _altoffid=MondoVolume +echo Converting Retail To Volume [%%# To !_altoffid!] [Using Mondo because %%# is not found in the script] +) +echo %%# | find /i "O365" %nul% && ( +if "%oVer%"=="15" (call :dk_color %Gray% "Mondo 2013 is equivalent to O365 [15.0 version] in terms of the latest features.") +if "%oVer%"=="16" (call :dk_color %Gray% "Mondo 2016 is equivalent to O365 in terms of the latest features.") +) +call :ks_osppready +) + +if /i %tsmethod%==KMS4k ( +echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=ks) +) else ( set keytype=zero +) + for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) ) @@ -1833,7 +2197,7 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( +if /i not %tsmethod%==KMS4k if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% @@ -1941,7 +2305,7 @@ exit /b :oh_clearblock :: Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing -:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state +:: https://learn.microsoft.com/en-us/office/troubleshoot/activation/reset-office-365-proplus-activation-state set _sidlist= for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a)) @@ -2037,12 +2401,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share ) :: Clear device-based-licensing -:: https://learn.microsoft.com/deployoffice/device-based-licensing +:: https://learn.microsoft.com/en-us/deployoffice/device-based-licensing for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul% :: Remove OEM registry key -:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 +:: https://support.microsoft.com/en-us/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 for %%# in (15 16) do ( reg delete "HKLM\SOFTWARE\Microsoft\Office\%%#.0\Common\OEM" /f %nul% @@ -2138,6 +2502,59 @@ exit /b ::======================================================================================================================================== +:: Clean existing K-M-S cache from the registry + +:_taskclear-cache + +set w= +for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do ( +reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul% +) + +set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" + +if %winbuild% LSS 7600 ( +reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && ( +set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" +) +) +if not defined SPPk ( +set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" +) + +set "slp=SoftwareLicensingProduct" +set "ospp=OfficeSoftwareProtectionProduct" + +set "_wApp=55c92734-d682-4d71-983e-d6ec3f16059f" +set "_oApp=0ff1ce15-a989-479d-af46-f275c6370663" +set "_oA14=59a52881-a989-479d-af46-f275c6370663" + +%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName +%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName /reg:32 +%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort +%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort /reg:32 +%nul% reg delete "HKLM\%SPPk%" /f /v DisableDnsPublishing +%nul% reg delete "HKLM\%SPPk%" /f /v DisableKeyManagementServiceHostCaching +%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f +if %winbuild% GEQ 9200 ( +%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f +%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f /reg:32 +) +if %winbuild% GEQ 9600 ( +%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_wApp%" /f +%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_oApp%" /f +) +%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServiceName +%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServicePort +%nul% reg delete "HKLM\%OPPk%" /f /v DisableDnsPublishing +%nul% reg delete "HKLM\%OPPk%" /f /v DisableKeyManagementServiceHostCaching +%nul% reg delete "HKLM\%OPPk%\%_oA14%" /f +%nul% reg delete "HKLM\%OPPk%\%_oApp%" /f + +exit /b + +::======================================================================================================================================== + :: Set variables :dk_setvar @@ -2332,9 +2749,9 @@ if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISE if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( set len=0 -echo:!allapps!> %SystemRoot%\Temp\chklen -for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) -del %SystemRoot%\Temp\chklen %nul% +echo:!allapps!> "!_ttemp!\chklen" +for %%A in ("!_ttemp!\chklen") do (set len=%%~zA) +del "!_ttemp!\chklen" %nul% if !len! GTR 6000 ( %eline% @@ -2430,7 +2847,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '' -replace [string][char]0xae, '' -replace [string][char]0x2122, '' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -2496,7 +2913,7 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re if not "%results%%pupfound%"=="" ( if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." -if defined results call :dk_color %Red% "%results%" +if defined results (call :dk_color %Red% "%results%"&set showfix=1) set fixes=%fixes% %mas%remove_mal%w%ware call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: @@ -2635,7 +3052,7 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option ) -:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states +:: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-states for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B) @@ -2706,10 +3123,13 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed ) if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" ( +if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-%osedition%Edition*.mum" ( call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]" ) ) ) +) + if %_wmic% EQU 1 wmic path %sps% get Version %nul% if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% @@ -2903,7 +3323,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -3028,7 +3448,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( @@ -3045,6 +3466,220 @@ exit /b :tsforge: $src = @' +#if !POWERSHELL2 +namespace ActivationWs +{ + +/* + +This code is adapted from ActivationWs. +Original Repository: https://github.com/dadorner-msft/activationws + +MIT License + +Copyright (c) Daniel Dorner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +using System; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Text; +using System.Xml.Linq; + + public static class ActivationHelper { + // Key for HMAC/SHA256 signature. + private static readonly byte[] MacKey = new byte[64] { + 254, 49, 152, 117, 251, 72, 132, 134, + 156, 243, 241, 206, 153, 168, 144, 100, + 171, 87, 31, 202, 71, 4, 80, 88, + 48, 36, 226, 20, 98, 135, 121, 160, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }; + + private const string Action = "http://www.microsoft.com/BatchActivationService/BatchActivate"; + + private static readonly Uri Uri = new Uri("https://activation.sls.microsoft.com/BatchActivation/BatchActivation.asmx"); + + private static readonly XNamespace SoapSchemaNs = "http://schemas.xmlsoap.org/soap/envelope/"; + private static readonly XNamespace XmlSchemaInstanceNs = "http://www.w3.org/2001/XMLSchema-instance"; + private static readonly XNamespace XmlSchemaNs = "http://www.w3.org/2001/XMLSchema"; + private static readonly XNamespace BatchActivationServiceNs = "http://www.microsoft.com/BatchActivationService"; + private static readonly XNamespace BatchActivationRequestNs = "http://www.microsoft.com/DRM/SL/BatchActivationRequest/1.0"; + private static readonly XNamespace BatchActivationResponseNs = "http://www.microsoft.com/DRM/SL/BatchActivationResponse/1.0"; + + public static string CallWebService(int requestType, string installationId, string extendedProductId) { + XDocument soapRequest = CreateSoapRequest(requestType, installationId, extendedProductId); + HttpWebRequest webRequest = CreateWebRequest(soapRequest); + XDocument soapResponse = new XDocument(); + + try { + IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null); + asyncResult.AsyncWaitHandle.WaitOne(); + + // Read data from the response stream. + using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult)) + using (StreamReader streamReader = new StreamReader(webResponse.GetResponseStream())) { + soapResponse = XDocument.Parse(streamReader.ReadToEnd()); + } + + return ParseSoapResponse(soapResponse); + + } catch { + throw; + } + } + + private static XDocument CreateSoapRequest(int requestType, string installationId, string extendedProductId) { + // Create an activation request. + XElement activationRequest = new XElement(BatchActivationRequestNs + "ActivationRequest", + new XElement(BatchActivationRequestNs + "VersionNumber", "2.0"), + new XElement(BatchActivationRequestNs + "RequestType", requestType), + new XElement(BatchActivationRequestNs + "Requests", + new XElement(BatchActivationRequestNs + "Request", + new XElement(BatchActivationRequestNs + "PID", extendedProductId), + requestType == 1 ? new XElement(BatchActivationRequestNs + "IID", installationId) : null) + ) + ); + + // Get the unicode byte array of activationRequest and convert it to Base64. + byte[] bytes = Encoding.Unicode.GetBytes(activationRequest.ToString()); + string requestXml = Convert.ToBase64String(bytes); + + XDocument soapRequest = new XDocument(); + + using (HMACSHA256 hMACSHA = new HMACSHA256(MacKey)) { + // Convert the HMAC hashed data to Base64. + string digest = Convert.ToBase64String(hMACSHA.ComputeHash(bytes)); + + soapRequest = new XDocument( + new XDeclaration("1.0", "UTF-8", "no"), + new XElement(SoapSchemaNs + "Envelope", + new XAttribute(XNamespace.Xmlns + "soap", SoapSchemaNs), + new XAttribute(XNamespace.Xmlns + "xsi", XmlSchemaInstanceNs), + new XAttribute(XNamespace.Xmlns + "xsd", XmlSchemaNs), + new XElement(SoapSchemaNs + "Body", + new XElement(BatchActivationServiceNs + "BatchActivate", + new XElement(BatchActivationServiceNs + "request", + new XElement(BatchActivationServiceNs + "Digest", digest), + new XElement(BatchActivationServiceNs + "RequestXml", requestXml) + ) + ) + ) + )); + + } + + return soapRequest; + } + + private static HttpWebRequest CreateWebRequest(XDocument soapRequest) { + HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(Uri); + webRequest.Accept = "text/xml"; + webRequest.ContentType = "text/xml; charset=\"utf-8\""; + webRequest.Headers.Add("SOAPAction", Action); + webRequest.Host = "activation.sls.microsoft.com"; + webRequest.Method = "POST"; + + try { + // Insert SOAP envelope + using (Stream stream = webRequest.GetRequestStream()) { + soapRequest.Save(stream); + } + + return webRequest; + + } catch { + throw; + } + } + + private static string ParseSoapResponse(XDocument soapResponse) { + if (soapResponse == null) { + throw new ArgumentNullException("soapResponse", "The remote server returned an unexpected response."); + } + + if (!soapResponse.Descendants(BatchActivationServiceNs + "ResponseXml").Any()) { + throw new Exception("The remote server returned an unexpected response"); + } + + try { + XDocument responseXml = XDocument.Parse(soapResponse.Descendants(BatchActivationServiceNs + "ResponseXml").First().Value); + + if (responseXml.Descendants(BatchActivationResponseNs + "ErrorCode").Any()) { + string errorCode = responseXml.Descendants(BatchActivationResponseNs + "ErrorCode").First().Value; + + switch (errorCode) { + case "0x7F": + throw new Exception("The Multiple Activation Key has exceeded its limit"); + + case "0x67": + throw new Exception("The product key has been blocked"); + + case "0x68": + throw new Exception("Invalid product key"); + + case "0x86": + throw new Exception("Invalid key type"); + + case "0x90": + throw new Exception("Please check the Installation ID and try again"); + + default: + throw new Exception(string.Format("The remote server reported an error ({0})", errorCode)); + } + + } else if (responseXml.Descendants(BatchActivationResponseNs + "ResponseType").Any()) { + string responseType = responseXml.Descendants(BatchActivationResponseNs + "ResponseType").First().Value; + + switch (responseType) { + case "1": + string confirmationId = responseXml.Descendants(BatchActivationResponseNs + "CID").First().Value; + return confirmationId; + + case "2": + string activationsRemaining = responseXml.Descendants(BatchActivationResponseNs + "ActivationRemaining").First().Value; + return activationsRemaining; + + default: + throw new Exception("The remote server returned an unrecognized response"); + } + + } else { + throw new Exception("The remote server returned an unrecognized response"); + } + + } catch { + throw; + } + } + } +} +#endif + // Common.cs namespace LibTSforge { @@ -5606,27 +6241,23 @@ namespace LibTSforge.Modifiers } -// Activators/AVMA4K.cs +// Activators/KMS4K.cs namespace LibTSforge.Activators { using System; + using System.IO; using PhysicalStore; using SPP; - public static class AVMA4k + public class KMS4k { public static void Activate(PSVersion version, bool production, Guid actId) { - if (version != PSVersion.WinModern && version != PSVersion.WinBlue) - { - throw new NotSupportedException("AVMA licenses are not available for this product."); - } - Guid appId; if (actId == Guid.Empty) { appId = SLApi.WINDOWS_APP_ID; - actId = SLApi.GetDefaultActivationID(appId, false); + actId = SLApi.GetDefaultActivationID(appId, true); if (actId == Guid.Empty) { @@ -5638,9 +6269,9 @@ namespace LibTSforge.Activators appId = SLApi.GetAppId(actId); } - if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "VT:IA") + if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "Volume:GVLK") { - throw new NotSupportedException("Non-VT:IA product key installed."); + throw new NotSupportedException("Non-Volume:GVLK product key installed."); } SPPUtils.KillSPP(version); @@ -5651,80 +6282,171 @@ namespace LibTSforge.Activators { string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); - long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); - long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); - long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + ulong unknown = 0; + ulong time1; + ulong time2 = (ulong)DateTime.UtcNow.ToFileTime(); + ulong expiry = Constants.TimerMax; - const ulong unknown = 0; - ulong time1 = (ulong)(creationTime + tickCount + deltaTime); - ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime(); - ulong timerTime = crcBindTime / 10000; - ulong expiry = Constants.TimerMax / 10000; - - VariableBag avmaBinding = new VariableBag(version); - - avmaBinding.Blocks.AddRange(new[] + if (version == PSVersion.Vista || version == PSVersion.Win7) { + unknown = 0x800000000; + time1 = 0; + } + else + { + long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); + long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); + long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + + time1 = (ulong)(creationTime + tickCount + deltaTime); + time2 /= 10000; + expiry /= 10000; + } + + if (version == PSVersion.Vista) + { + VistaTimer vistaTimer = new VistaTimer + { + Time = time2, + Expiry = Constants.TimerMax + }; + + string vistaTimerName = string.Format("msft:sl/timer/VLExpiration/VOLUME/{0}/{1}", appId, actId); + + store.DeleteBlock(key, vistaTimerName); + store.DeleteBlock(key, actId.ToString()); + + BinaryWriter writer = new BinaryWriter(new MemoryStream()); + writer.Write(Constants.KMSv4Response.Length); + writer.Write(Constants.KMSv4Response); + writer.Write(Constants.UniversalHWIDBlock); + byte[] kmsData = writer.GetBytes(); + + store.AddBlocks(new[] + { + new PSBlock + { + Type = BlockType.TIMER, + Flags = 0, + KeyAsStr = key, + ValueAsStr = vistaTimerName, + Data = vistaTimer.CastToArray() + }, + new PSBlock + { + Type = BlockType.NAMED, + Flags = 0, + KeyAsStr = key, + ValueAsStr = actId.ToString(), + Data = kmsData + } + }); + } + else + { + byte[] hwidBlock = Constants.UniversalHWIDBlock; + byte[] kmsResp; + + switch (version) + { + case PSVersion.Win7: + kmsResp = Constants.KMSv4Response; + break; + case PSVersion.Win8: + kmsResp = Constants.KMSv5Response; + break; + case PSVersion.WinBlue: + case PSVersion.WinModern: + kmsResp = Constants.KMSv6Response; + break; + default: + throw new NotSupportedException("Unsupported PSVersion."); + } + + VariableBag kmsBinding = new VariableBag(version); + + kmsBinding.Blocks.AddRange(new[] + { new CRCBlockModern { DataType = CRCBlockType.BINARY, Key = new byte[] { }, - Value = BitConverter.GetBytes(crcBindTime), + Value = kmsResp }, new CRCBlockModern { DataType = CRCBlockType.STRING, Key = new byte[] { }, - ValueAsStr = "AVMA4K", + ValueAsStr = "msft:rm/algorithm/hwid/4.0" }, new CRCBlockModern { - DataType = CRCBlockType.STRING, - Key = new byte[] { }, - ValueAsStr = "00491-50000-00001-AA666", + DataType = CRCBlockType.BINARY, + KeyAsStr = "SppBindingLicenseData", + Value = hwidBlock } - }); + }); - byte[] avmaBindingData = avmaBinding.Serialize(); + if (version == PSVersion.WinModern) + { + kmsBinding.Blocks.AddRange(new[] + { + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "massgrave.dev" + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "6969" + } + }); + } - Timer avmaTimer = new Timer - { - Unknown = unknown, - Time1 = time1, - Time2 = timerTime, - Expiry = expiry - }; + byte[] kmsBindingData = kmsBinding.Serialize(); - string storeVal = string.Format("msft:spp/ia/bind/1.0/store/{0}/{1}", appId, actId); - string timerVal = string.Format("msft:spp/ia/bind/1.0/timer/{0}/{1}", appId, actId); + Timer kmsTimer = new Timer + { + Unknown = unknown, + Time1 = time1, + Time2 = time2, + Expiry = expiry + }; - store.DeleteBlock(key, storeVal); - store.DeleteBlock(key, timerVal); + string storeVal = string.Format("msft:spp/kms/bind/2.0/store/{0}/{1}", appId, actId); + string timerVal = string.Format("msft:spp/kms/bind/2.0/timer/{0}/{1}", appId, actId); - store.AddBlocks(new[] - { + store.DeleteBlock(key, storeVal); + store.DeleteBlock(key, timerVal); + + store.AddBlocks(new[] + { new PSBlock { Type = BlockType.NAMED, - Flags = 0x400, + Flags = (version == PSVersion.WinModern) ? (uint)0x400 : 0, KeyAsStr = key, ValueAsStr = storeVal, - Data = avmaBindingData, + Data = kmsBindingData }, new PSBlock { Type = BlockType.TIMER, - Flags = 0x4, + Flags = (version == PSVersion.Win7) ? (uint)0 : 0x4, KeyAsStr = key, ValueAsStr = timerVal, - Data = avmaTimer.CastToArray() + Data = kmsTimer.CastToArray() } - }); + }); + } } - SLApi.RefreshLicenseStatus(); + SPPUtils.RestartSPP(version); SLApi.FireStateChangedEvent(appId); - Logger.WriteLine("Activated using AVMA4k successfully."); + Logger.WriteLine("Activated using KMS4k successfully."); } } } @@ -7831,15 +8553,16 @@ namespace LibTSforge.PhysicalStore '@ $ErrorActionPreference = 'Stop' $binPath = "$env:_work\BIN\LibTSforge.dll" +$psMajorVer = (Get-Host).Version.Major if (Test-Path -LiteralPath $binPath) { Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." Add-Type -Path $binPath } else { - $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") - $cp.CompilerOptions = "/unsafe" - $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } + $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll") + if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" } + $lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" } $ctemp = "$env:SystemRoot\Temp\" if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } @@ -7888,32 +8611,65 @@ function slGetSkuInfo($SkuId) { if (-not $env:resetstuff) { foreach ($tsactid in $tsactids) { try { + $activated = $null $prodDes = Get-WmiInfo -tsactid $tsactid -property "Description" $prodName = Get-WmiInfo -tsactid $tsactid -property "Name" if ($prodName) { $nameParts = $prodName -split ',', 2 $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } - if (-not $env:_vis) { - [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) - } - if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { + if (-not $env:_vis -and -not $env:oldks) { + [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + } + if ($prodName -match 'Office' -and $prodDes -notmatch 'KMS' -and -not (slGetSkuInfo($tsactid))) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { Write-Host "[$prodName] is already permanently activated." -ForegroundColor White -BackgroundColor DarkGreen continue } } - [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) - $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" - if ($licenseStatus -eq 1) { + if ($env:tsmethod -eq "StaticCID") { + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + $attempts = @( + @(100055, 1000043, 1338662172562478), + @(1345, 1003020, 6311608238084405) + ) + foreach ($params in $attempts) { + [LibTSforge.Modifiers.SetIIDParams]::SetParams($ver, $prod, $tsactid, [LibTSforge.SPP.PKeyAlgorithm]::PKEY2009, $params[0], $params[1], $params[2]) + $instId = [LibTSforge.SPP.SLApi]::GetInstallationID($tsactid) + $confId = [ActivationWs.ActivationHelper]::CallWebService(1, $instId, "31337-42069-123-456789-04-1337-2600.0000-2542001") + $result = [LibTSforge.SPP.SLApi]::DepositConfirmationID($tsactid, $instId, $confId) + if ($result -eq 0) { break } + } + [LibTSforge.SPP.SPPUtils]::RestartSPP($ver) + } + elseif ($env:tsmethod -eq "KMS4k") { + [LibTSforge.Activators.KMS4k]::Activate($ver, $prod, $tsactid) + } + else { + [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) + } + if ($env:tsmethod -eq "KMS4k") { + $GracePeriodStatus = Get-WmiInfo -tsactid $tsactid -property "GracePeriodRemaining" + if ($GracePeriodStatus -gt 259200) { $activated = 1 } + } + else { + $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" + if ($licenseStatus -eq 1) { $activated = 1 } + } + if ($activated) { if ($prodDes -match 'KMS' -and $prodDes -notmatch 'CLIENT') { [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $prod, $tsactid) - Write-Host "[$prodName] CSVLK is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen + Write-Host "[$prodName] CSVLK is permanently activated with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] CSVLK is charged with 25 clients for 30 days." -ForegroundColor White -BackgroundColor DarkGreen } else { - Write-Host "[$prodName] is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen + if ($env:tsmethod -eq "KMS4k") { + Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen + } + else { + Write-Host "[$prodName] is permanently activated with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen + } } } else { @@ -7931,11 +8687,11 @@ if (-not $env:resetstuff) { if ($env:resetstuff) { try { - if (-not $env:_vis) {[LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod)} + if (-not $env:_vis) { [LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod) } [LibTSforge.SPP.SLApi]::RefreshLicenseStatus() [LibTSforge.Modifiers.RearmReset]::Reset($ver, $prod) [LibTSforge.Modifiers.GracePeriodReset]::Reset($ver, $prod) - if (-not $env:_vis) {[LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod)} + if (-not $env:_vis) { [LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod) } } catch { $errcode = 3 @@ -8180,7 +8936,7 @@ function Office-ActID { } } - $filterPreview = $filteredConfigs | Where-Object { $_.ProductDescription -notmatch 'preview' } + $filterPreview = $filteredConfigs | Where-Object { $_.ProductDescription -notmatch 'preview|c2r' } if ($filterPreview.Count -ne 0) { $filteredConfigs = $filterPreview @@ -8375,6 +9131,130 @@ exit /b ::======================================================================================================================================== +:: 1st column = Office version +:: 2nd column = Volume or free retail product +:: 3rd column = Retail product names that needs to be converted to the Volume product mentioned in 2nd column +:: Separator = "_" + +:tsksdata + +set f= +for %%# in ( +:: Office 2013 +15_AccessVolume_-AccessRetail- +15_AccessRuntimeRetail +15_ExcelVolume_-ExcelRetail- +15_GrooveVolume_-GrooveRetail- +15_InfoPathVolume_-InfoPathRetail- +15_LyncAcademicRetail +15_LyncEntryRetail +15_LyncVolume_-LyncRetail- +15_MondoRetail +15_MondoVolume_-O365BusinessRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +15_OneNoteFreeRetail +15_OneNoteVolume_-OneNoteRetail- +15_OutlookVolume_-OutlookRetail- +15_PowerPointVolume_-PowerPointRetail- +15_ProjectProVolume_-ProjectProRetail- +15_ProjectStdVolume_-ProjectStdRetail- +15_ProPlusVolume_-ProPlusRetail-ProfessionalPipcRetail-ProfessionalRetail- +15_PublisherVolume_-PublisherRetail- +15_SPDRetail +15_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-PersonalPipcRetail-PersonalRetail- +15_VisioProVolume_-VisioProRetail- +15_VisioStdVolume_-VisioStdRetail- +15_WordVolume_-WordRetail- +:: Office 2016 +16_AccessRuntimeRetail +16_AccessVolume_-AccessRetail- +16_ExcelVolume_-ExcelRetail- +16_MondoRetail +16_MondoVolume_-O365AppsBasicRetail-O365BusinessRetail-O365EduCloudRetail-O365HomePremRetail-O365ProPlusRetail-O365SmallBusPremRetail- +16_OneNoteFreeRetail +16_OneNoteVolume_-OneNoteRetail-OneNote2021Retail- +16_OutlookVolume_-OutlookRetail- +16_PowerPointVolume_-PowerPointRetail- +16_ProjectProVolume_-ProjectProRetail- +16_ProjectProXVolume +16_ProjectStdVolume_-ProjectStdRetail- +16_ProjectStdXVolume +16_ProPlusVolume_-ProPlusRetail-ProfessionalPipcRetail-ProfessionalRetail- +16_PublisherVolume_-PublisherRetail- +16_SkypeServiceBypassRetail +16_SkypeforBusinessEntryRetail +16_SkypeforBusinessVolume_-SkypeforBusinessRetail- +16_StandardVolume_-StandardRetail-HomeBusinessPipcRetail-HomeBusinessRetail-HomeStudentARMRetail-HomeStudentPlusARMRetail-HomeStudentRetail-HomeStudentVNextRetail-PersonalPipcRetail-PersonalRetail- +16_VisioProVolume_-VisioProRetail- +16_VisioProXVolume +16_VisioStdVolume_-VisioStdRetail- +16_VisioStdXVolume +16_WordVolume_-WordRetail- +:: Office 2019 +16_AccessRuntime2019Retail +16_Access2019Volume_-Access2019Retail- +16_Excel2019Volume_-Excel2019Retail- +16_Outlook2019Volume_-Outlook2019Retail- +16_PowerPoint2019Volume_-PowerPoint2019Retail- +16_ProjectPro2019Volume_-ProjectPro2019Retail- +16_ProjectStd2019Volume_-ProjectStd2019Retail- +16_ProPlus2019Volume_-ProPlus2019Retail-Professional2019Retail- +16_Publisher2019Volume_-Publisher2019Retail- +16_SkypeforBusiness2019Volume_-SkypeforBusiness2019Retail- +16_SkypeforBusinessEntry2019Retail +16_Standard2019Volume_-Standard2019Retail-HomeBusiness2019Retail-HomeStudentARM2019Retail-HomeStudentPlusARM2019Retail-HomeStudent2019Retail-Personal2019Retail- +16_VisioPro2019Volume_-VisioPro2019Retail- +16_VisioStd2019Volume_-VisioStd2019Retail- +16_Word2019Volume_-Word2019Retail- +:: Office 2021 +:: OneNote2021Volume KMS license is not available +16_AccessRuntime2021Retail +16_Access2021Volume_-Access2021Retail- +16_Excel2021Volume_-Excel2021Retail- +16_Outlook2021Volume_-Outlook2021Retail- +16_OneNoteFree2021Retail +16_PowerPoint2021Volume_-PowerPoint2021Retail- +16_ProjectPro2021Volume_-ProjectPro2021Retail- +16_ProjectStd2021Volume_-ProjectStd2021Retail- +16_ProPlus2021Volume_-ProPlus2021Retail-Professional2021Retail- +16_Publisher2021Volume_-Publisher2021Retail- +16_SkypeforBusiness2021Volume_-SkypeforBusiness2021Retail- +16_Standard2021Volume_-Standard2021Retail-HomeBusiness2021Retail-HomeStudent2021Retail-Personal2021Retail- +16_VisioPro2021Volume_-VisioPro2021Retail- +16_VisioStd2021Volume_-VisioStd2021Retail- +16_Word2021Volume_-Word2021Retail- +:: Office 2024 +16_Access2024Volume_-Access2024Retail- +16_Excel2024Volume_-Excel2024Retail- +16_Outlook2024Volume_-Outlook2024Retail- +16_PowerPoint2024Volume_-PowerPoint2024Retail- +16_ProjectPro2024Volume_-ProjectPro2024Retail- +16_ProjectStd2024Volume_-ProjectStd2024Retail- +16_ProPlus2024Volume_-ProPlus2024Retail- +16_SkypeforBusiness2024Volume +16_Standard2024Volume_-Home2024Retail-HomeBusiness2024Retail- +16_VisioPro2024Volume_-VisioPro2024Retail- +16_VisioStd2024Volume_-VisioStd2024Retail- +16_Word2024Volume_-Word2024Retail- +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( + +if %1==chkprod if "%oVer%"=="%%A" if not defined foundprod ( +if /i "%%B"=="%2" set foundprod=1 +) + +if %1==getinfo if "%oVer%"=="%%A" ( +echo: %%C | find /i "-%2-" %nul% && ( +set _License=%%B +set _altoffid=%%B +) +) + +) +) +exit /b + +::======================================================================================================================================== + :ts_getedition set tsedition= diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 951a5b9..f83e68c 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -60,6 +60,8 @@ exit /b set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -192,12 +194,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -227,7 +231,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -309,7 +319,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -323,15 +333,6 @@ echo: echo Initializing... echo: -if not exist %SysPath%\sppsvc.exe ( -%eline% -echo [%SysPath%\sppsvc.exe] file is missing. Aborting... -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" -goto dk_done -) - ::======================================================================================================================================== set spp=SoftwareLicensingProduct @@ -365,8 +366,7 @@ if %osedition%==0 ( %eline% echo Failed to detect OS Edition. Aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -415,6 +415,7 @@ _updch _lang _clversion _version +_AudienceData _oIds _c2rXml _c2rExe @@ -802,8 +803,40 @@ set errorcode=%errorlevel% timeout /t 10 %nul% echo: +set suggestchannel= + if %errorcode% EQU 0 ( -call :dk_color %Gray% "Now run the Office activation option from the main menu." +if %change%==1 ( +echo %targetedition% | find /i "2019Volume" %nul% && ( +if not defined ltsc19 set suggestchannel=Production::LTSC +if /i not %_AudienceData%==Production::LTSC set suggestchannel=Production::LTSC +if /i not %_updch%==F2E724C1-748F-4B47-8FB8-8E0D210E9208 set suggestchannel=Production::LTSC +) + +echo %targetedition% | find /i "2021Volume" %nul% && ( +if not defined ltsc21 set suggestchannel=Production::LTSC2021 +if /i not %_AudienceData%==Production::LTSC2021 set suggestchannel=Production::LTSC2021 +if /i not %_updch%==5030841D-C919-4594-8D2D-84AE4F96E58E set suggestchannel=Production::LTSC2021 +) + +echo %targetedition% | find /i "2024Volume" %nul% && ( +if not defined ltsc24 set suggestchannel=Production::LTSC2024 +if /i not %_AudienceData%==Production::LTSC2024 set suggestchannel=Production::LTSC2024 +if /i not %_updch%==7983BAC0-E531-40CF-BE00-FD24FE66619C set suggestchannel=Production::LTSC2024 +) + +echo %targetedition% | findstr /R "20.*Volume" %nul% || ( +if defined ltscfound set suggestchannel=Production::CC +echo %_AudienceData% | find /i "LTSC" %nul% && set suggestchannel=Production::CC +) + +if defined suggestchannel ( +call :dk_color %Gray% "Mismatch found in update channel and installed product." +call :dk_color %Blue% "It is recommended to change the update channel to [!suggestchannel!] from the previous menu." +) +echo: +) +call :dk_color %Gray% "To activate Office, run the activation option from the main menu." ) else ( set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -980,6 +1013,12 @@ echo Installed Office editions: %_oIds% echo Unsupported Office edition is installed on your Windows build version %winbuild%. goto :oe_goback ) +if defined ltscfound ( +%eline% +echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24% +echo Unsupported Office update channel is installed on your Windows build version %winbuild%. +goto :oe_goback +) ) ::=============== @@ -988,49 +1027,52 @@ set inpt= set counter=0 set verified=0 set targetFFN= +set bypassFFN= set targetchannel= %line% echo: call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%" -call :dk_color %Gray% "Unsupported update channels are excluded from this list." +call :dk_color %Gray% "Installed Office editions: %_oIds%" %line% echo: for %%# in ( -"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain" -"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC" -"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC" -"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC" -"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC" -"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC" -"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain" -"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain" -"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC" -"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC" -"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021" -"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021" -"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024" -"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024" +"5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -" +"64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -" +"492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -" +"55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -" +"b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -" +"7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -" +"ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -" +"b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -" +"f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -" +"1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -" +"5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -" +"86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -" +"7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -" +"c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -" ) do ( for /f "tokens=1-2 delims=_" %%A in ("%%~#") do ( +set bypass= set supported= if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1) if %winbuild% GEQ 10240 ( -if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported= -if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported= -if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported= -if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported= +if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set bypass=1 +if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1 +if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1 +if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1 ) if defined supported ( set /a counter+=1 if !counter! LSS 10 ( -echo [!counter!] %%B +if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B) ) else ( -echo [!counter!] %%B +if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B) ) set targetFFN!counter!=%%A set targetchannel!counter!=%%B +if defined bypass set bypassFFN=!bypassFFN!%%A ) ) ) @@ -1044,7 +1086,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En set /p inpt= if "%inpt%"=="" goto :oe_changeupdchnl if "%inpt%"=="0" goto :oemenu -if /i "%inpt%"=="R" start https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl +if /i "%inpt%"=="R" start https://learn.microsoft.com/en-us/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1) set targetFFN=!targetFFN%inpt%! set targetchannel=!targetchannel%inpt%! @@ -1061,15 +1103,133 @@ set build= for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a) echo "%build%" | find /i "16." %nul% || set build= +echo: +for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A) +echo Target build number: %build% +echo: %bypassFFN% | find /i "%targetFFN%" %nul% && goto :oe_changeunoff + +call :oe_cleanupreg + +if not defined build ( +if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN." +set "updcommand="%_c2rCexe%" /update user" +) else ( +set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%" +) +echo Running the below command to trigger updates... +echo: +echo %updcommand% +%updcommand% +echo: +echo Check this webpage for help - %mas%troubleshoot +goto :oe_goback + +::======================= + +:: Unofficial method to change channel + +:oe_changeunoff + +set abortchange= +echo %targetchannel% | find /i "2019 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2019Volume" %nul% || set abortchange=1)) +echo %targetchannel% | find /i "2021 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2021Volume" %nul% || set abortchange=1)) +echo %targetchannel% | find /i "2024 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2024Volume" %nul% || set abortchange=1)) + +if defined abortchange ( +%eline% +echo Mismatch found in installed Office products and target update channel. Aborting... +echo Non-perpetual Office products are not suppported with Perpetual VL update channels. +goto :oe_goback +) + +if not defined build ( +%eline% +call :dk_color %Red% "Failed to detect build number for the target FFN." +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +goto :oe_goback +) + +set buildchk=0 +for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a" + +set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" +set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE" + +if %clverchk% LSS %buildchk% ( +echo: +call :dk_color %Blue% "Do not terminate the operation before it completes..." +echo: +echo Updating Office C2R client with the command below, please wait... +echo: +echo %c2rclientupdate% +%c2rclientupdate% +for /l %%i in (1,1,30) do (if !clverchk! LSS %buildchk% (call :ch_getinfo&timeout /t 10 %nul%)) +) + +if %clverchk% LSS %buildchk% ( +echo: +call :dk_color %Red% "Failed to update Office C2R client. Aborting..." +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +goto :oe_goback +) + +call :oe_cleanupreg + +echo Running the below command to change update channel, please wait... +echo: +echo %c2rcommand% +%c2rcommand% +set errorcode=%errorlevel% +timeout /t 10 %nul% + +echo: +if %errorcode% EQU 0 ( +call :dk_color %Gray% "Now run the Office activation option from the main menu." +) else ( +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +) + +::======================================================================================================================================== + +:oe_goback + +call :oe_tempcleanup + +echo: +if defined fixes ( +call :dk_color %White% "Follow ALL the ABOVE blue lines. " +call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" +choice /C:10 /N +if !errorlevel!==2 goto :oemenu +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) +) + +if defined terminal ( +call :dk_color %_Yellow% "Press [0] key to go back..." +choice /c 0 /n +) else ( +call :dk_color %_Yellow% "Press any key to go back..." +pause %nul1% +) +goto :oemenu + +::======================================================================================================================================== + +:oe_cleanupreg + :: Cleanup Office update related registries, thanks to @abbodi1406 :: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813 :: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels -echo: -for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A) echo: echo Cleaning Office update registry keys... echo Adding new update channel to registry keys... +echo: %nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f %nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f @@ -1086,42 +1246,7 @@ echo Adding new update channel to registry keys... %nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32 %nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f -if not defined build ( -if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN." -set "updcommand="%_c2rCexe%" /update user" -) else ( -set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%" -) -echo Running the below command to trigger updates... -echo: -echo %updcommand% -%updcommand% -echo: -echo Check this webpage for help - %mas%troubleshoot -goto :oe_goback - -::======================================================================================================================================== - -:oe_goback - -call :oe_tempcleanup - -echo: -if defined fixes ( -call :dk_color %White% "Follow ALL the ABOVE blue lines. " -call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" -choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) -) - -if defined terminal ( -call :dk_color %_Yellow% "Press [0] key to go back..." -choice /c 0 /n -) else ( -call :dk_color %_Yellow% "Press any key to go back..." -pause %nul1% -) -goto :oemenu +exit /b ::======================================================================================================================================== @@ -1144,6 +1269,7 @@ set _oRoot= set _oArch= set _updch= set _oIds= +set _firstoId= set _lang= set _cfolder= set _version= @@ -1174,9 +1300,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a") ) set _oIds=%_oIds:.16=% +for /f "tokens=1" %%A in ("%_oIds%") do set _firstoId=%%A +for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v %_firstoId%.ExcludedApps" %nul6%') do (set "_firstoIdExcludelist=%%b") set verchk=0 +set clverchk=0 for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a" +for /f "tokens=3 delims=." %%a in ("%_clversion%") do set "clverchk=%%a" if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" @@ -1192,16 +1322,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" ( set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe" ) -set "audidata4=%_AudienceData:~-4%" +:: Check LTSC version files -if /i "%audidata4%"=="LTSC" set ltsc19=LTSC -echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC - -if /i "%audidata4%"=="2021" set ltsc21=LTSC2021 -echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 - -if /i "%audidata4%"=="2024" set ltsc24=LTSC2024 -:: LTSC 2024 build is not fixed yet +for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do ( +echo "%%b" %nul2% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC +echo "%%b" %nul2% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 +echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024 +) if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1 @@ -1475,7 +1602,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 6529adf..905b584 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -65,6 +65,8 @@ exit /b set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -197,12 +199,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -232,7 +236,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -314,7 +324,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -390,8 +400,7 @@ if not defined allapps ( %eline% echo Failed to find activation IDs. Aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -413,8 +422,7 @@ if not defined osedition ( %eline% echo Failed to detect OS edition, aborting... echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" +call :dk_color %Blue% "To fix this issue, activate Windows from the main menu." goto dk_done ) @@ -795,7 +803,7 @@ exit /b :: https://stackoverflow.com/a/46268232 -set "ddf="%SystemRoot%\Temp\ddf"" +set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%"" %nul% del /q /f %ddf% echo/.New Cabinet>%ddf% echo/.set Cabinet=ON>>%ddf% @@ -1057,7 +1065,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/MAS/Separate-Files-Version/Check_Activation_Status.cmd b/MAS/Separate-Files-Version/Check_Activation_Status.cmd index 458b486..728b1a0 100644 --- a/MAS/Separate-Files-Version/Check_Activation_Status.cmd +++ b/MAS/Separate-Files-Version/Check_Activation_Status.cmd @@ -1072,8 +1072,8 @@ function PrintLicensesInformation function vNextDiagRun { - $fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0) - $fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GE 0) + $fNUL = ([IO.Directory]::Exists("${env:LOCALAPPDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:LOCALAPPDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0) + $fDev = ([IO.Directory]::Exists("${env:PROGRAMDATA}\Microsoft\Office\Licenses")) -and ([IO.Directory]::GetFiles("${env:PROGRAMDATA}\Microsoft\Office\Licenses", "*", 1).Length -GT 0) $rPID = $null -NE (GP "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext" -EA 0 | select -Expand 'property' -EA 0 | where -Filter {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}) $rSCA = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0) $rSCL = $null -NE (GP "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing" -EA 0 | select -Expand "SharedComputerLicensing" -EA 0) @@ -1340,7 +1340,7 @@ function clcGetExpireSys return $null } - $rData = [DateTime]::FromFileTimeUTC($kuser).ToString('yyyy/MM/dd:HH:mm:ss') + $rData = [DateTime]::FromFileTimeUtc($kuser).ToString('yyyy/MM/dd:HH:mm:ss') return $rData } diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 7f6eb25..7fa15af 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -60,6 +60,8 @@ exit /b set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -144,15 +146,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto done2 ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto done2 ) @@ -208,12 +210,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -243,7 +247,13 @@ goto done2 REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -325,7 +335,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -731,7 +741,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index bc4d49d..aebe72b 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -1,4 +1,4 @@ -@set masver=3.1 +@set masver=3.4 @echo off @@ -60,6 +60,8 @@ exit /b set "blank=" set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" +set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts" +set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts" :: Check if Null service is working, it's important for the batch script @@ -145,15 +147,15 @@ echo Upgrade to Windows Vista SP1 or SP2. goto dk_done ) -if not exist %ps% ( +if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" ( %nceline% +if not exist %ps% ( echo PowerShell is not installed in your system. -if %winbuild% LSS 7600 ( -echo Install PowerShell using the following URL. +) +echo Install PowerShell 2.0 using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -) goto dk_done ) @@ -209,12 +211,14 @@ for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[ if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo: %tstresult% -cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" +for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a) +echo Test 1 - %tstresult% +echo Test 2 - !tstresult2! +echo: REM check LanguageMode -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -244,7 +248,13 @@ goto dk_done REM check antivirus and other errors echo PowerShell is not working properly. Aborting... -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" + +if /i "!tstresult2!"=="FullLanguage" ( +echo: +echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" +) + echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -326,7 +336,7 @@ echo: call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" choice /C:10 /N if !errorlevel!==2 rem -if !errorlevel!==1 (start %mas% & exit /b) +if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b) ) ) @@ -387,7 +397,7 @@ if %_erl%==5 goto:retokens if %_erl%==4 goto:fixwmi if %_erl%==3 goto:sfcscan if %_erl%==2 goto:dism_rest -if %_erl%==1 start %mas%troubleshoot.html &goto at_menu +if %_erl%==1 (start %selfgit% & start %github% & start %mas%troubleshoot & goto at_menu) goto :at_menu ::======================================================================================================================================== @@ -733,7 +743,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof if %winbuild% LSS 9200 if not defined _vis ( REM Fix issues caused by Update KB971033 in Windows 7 -REM https://support.microsoft.com/help/4487266 +REM https://support.microsoft.com/en-us/help/4487266 echo: echo Checking Update KB971033... %psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul% @@ -874,12 +884,12 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=") reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=") -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe) @@ -1178,7 +1188,7 @@ goto :at_menu :: https://stackoverflow.com/a/46268232 -set "ddf="%SystemRoot%\Temp\ddf"" +set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%"" %nul% del /q /f %ddf% echo/.New Cabinet>%ddf% echo/.set Cabinet=ON>>%ddf% @@ -1230,7 +1240,7 @@ set "permerror=Error Found In SPP Registries" ) ) -REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if not defined permerror ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( @@ -1276,7 +1286,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') { } # Fix perms for SPP in HKU\S-1-5-20 -# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application +# https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') { exit @@ -1488,7 +1498,8 @@ if defined fixes ( call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" choice /C:10 /N -if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) +if !errorlevel!==2 exit /b +if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) ) if defined terminal ( diff --git a/README.md b/README.md index b3fdf00..53a01b9 100644 --- a/README.md +++ b/README.md @@ -1,118 +1,116 @@ -
Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.
- -Made with Love ❤️
+Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.
+ +Made with Love ❤️