aboutsummaryrefslogtreecommitdiff
path: root/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd')
-rw-r--r--MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd292
1 files changed, 225 insertions, 67 deletions
diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
index 4dfe882..61ffe1e 100644
--- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
+++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
@@ -1,9 +1,18 @@
1@set masver=2.4 1@set masver=2.5
2@setlocal DisableDelayedExpansion 2@setlocal DisableDelayedExpansion
3@echo off 3@echo off
4 4
5
6
7::============================================================================
5:: 8::
6::======================================================================================================================================== 9:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
10::
11:: Homepage: mass grave[.]dev
12:: Email: windowsaddict@protonmail.com
13::
14::============================================================================
15
7 16
8 17
9:: To activate Office with Ohook activation, run the script with "/Ohook" parameter or change 0 to 1 in below line 18:: To activate Office with Ohook activation, run the script with "/Ohook" parameter or change 0 to 1 in below line
@@ -15,6 +24,7 @@ set _rem=0
15:: If value is changed in above lines or parameter is used then script will run in unattended mode 24:: If value is changed in above lines or parameter is used then script will run in unattended mode
16 25
17 26
27
18::======================================================================================================================================== 28::========================================================================================================================================
19 29
20:: Set Path variable, it helps if it is misconfigured in the system 30:: Set Path variable, it helps if it is misconfigured in the system
@@ -178,7 +188,7 @@ set "_batp=%_batf:'=''%"
178set _PSarg="""%~f0""" -el %_args% 188set _PSarg="""%~f0""" -el %_args%
179 189
180set "_ttemp=%userprofile%\AppData\Local\Temp" 190set "_ttemp=%userprofile%\AppData\Local\Temp"
181 191set "_Local=%LocalAppData%"
182setlocal EnableDelayedExpansion 192setlocal EnableDelayedExpansion
183 193
184::======================================================================================================================================== 194::========================================================================================================================================
@@ -239,7 +249,7 @@ echo You are running outdated version MAS %masver%
239echo ________________________________________________ 249echo ________________________________________________
240echo: 250echo:
241if not %_unattended%==1 ( 251if not %_unattended%==1 (
242echo [1] Download Latest MAS 252echo [1] Get Latest MAS
243echo [0] Continue Anyway 253echo [0] Continue Anyway
244echo: 254echo:
245call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" 255call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
@@ -292,13 +302,29 @@ goto :oh_menu
292:oh_menu2 302:oh_menu2
293 303
294cls 304cls
295mode 128, 32 305mode 130, 32
296%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" 306%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
297 307
298title Ohook Activation %masver% 308title Ohook Activation %masver%
299 309
300echo: 310echo:
301echo Initializing... 311echo Initializing...
312
313:: Check PowerShell
314
315%psc% $ExecutionContext.SessionState.LanguageMode %nul2% | find /i "Full" %nul1% || (
316%eline%
317%psc% $ExecutionContext.SessionState.LanguageMode
318echo:
319echo PowerShell is not working. Aborting...
320echo If you have applied restrictions on Powershell then undo those changes.
321echo:
322echo Check this page for help. %mas%troubleshoot
323goto dk_done
324)
325
326::========================================================================================================================================
327
302call :dk_product 328call :dk_product
303call :dk_ckeckwmic 329call :dk_ckeckwmic
304 330
@@ -353,8 +379,8 @@ set o16uwp=
353 379
354set _68=HKLM\SOFTWARE\Microsoft\Office 380set _68=HKLM\SOFTWARE\Microsoft\Office
355set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office 381set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
356%nul% reg query %_68%\14.0\Common\InstallRoot /v Path && set o14msi=Office 2010 MSI 382for /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 )
357%nul% reg query %_86%\14.0\Common\InstallRoot /v Path && set o14msi=Office 2010 MSI 383for /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 )
358%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R 384%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
359%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R 385%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
360 386
@@ -433,10 +459,11 @@ if not defined _oArch for /f "skip=2 tokens=2*" %%a in ('"reg query %o15c2r_reg%
433 459
434echo "%o15c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9) 460echo "%o15c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
435for /f "tokens=%_tok% delims=\" %%a in ('reg query %o15c2r_reg%\ProductReleaseIDs\Active %nul6% ^| findstr /i "Retail Volume"') do ( 461for /f "tokens=%_tok% delims=\" %%a in ('reg query %o15c2r_reg%\ProductReleaseIDs\Active %nul6% ^| findstr /i "Retail Volume"') do (
436if not defined _oIds (set "_oIds=%%a") else (set "_oIds=!_oIds! %%a") 462echo "!_oIds!" | find /i " %%a " %nul1% || (set "_oIds= !_oIds! %%a ")
437) 463)
438 464
439set "_oLPath=%_oRoot%\Licenses" 465set "_oLPath=%_oRoot%\Licenses"
466set "_oIntegrator=%_oRoot%\integration\integrator.exe"
440 467
441if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") 468if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
442if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") 469if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
@@ -476,11 +503,12 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v Plat
476 503
477echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=9) || (set _tok=8) 504echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=9) || (set _tok=8)
478for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs" /s /f ".16" /k %nul6% ^| findstr /i "Retail Volume"') do ( 505for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs" /s /f ".16" /k %nul6% ^| findstr /i "Retail Volume"') do (
479if not defined _oIds (set "_oIds=%%a") else (set "_oIds=!_oIds! %%a") 506echo "!_oIds!" | find /i " %%a " %nul1% || (set "_oIds= !_oIds! %%a ")
480) 507)
481set _oIds=%_oIds:.16=% 508set _oIds=%_oIds:.16=%
482 509
483set "_oLPath=%_oRoot%\Licenses16" 510set "_oLPath=%_oRoot%\Licenses16"
511set "_oIntegrator=%_oRoot%\integration\integrator.exe"
484 512
485if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") 513if [%_oArch%]==[x64] (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
486if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") 514if [%_oArch%]==[x86] (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
@@ -510,12 +538,16 @@ call :oh_hookinstall
510 538
511set _sid= 539set _sid=
512set sub_next= 540set sub_next=
513for /f "tokens=* delims=" %%a in ('%psc% "$userSIDs = Get-WmiObject -Class Win32_UserAccount | ForEach-Object {write-host $_.SID}" %nul6%') do (if defined _sid (set "_sid=!_sid! HKU\%%a") else (set "_sid=HKU\%%a")) 541
542for /f "tokens=* delims=" %%a in ('%psc% "Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { Split-Path -Path $_.PSPath -Leaf }" %nul6%') do (if defined _sid (set "_sid=!_sid! HKU\%%a") else (set "_sid=HKU\%%a"))
514 543
515if not defined _sid ( 544if not defined _sid (
516call :dk_color %Red% "Checking User Accounts SID [Not Found]" 545call :dk_color %Red% "Checking User Accounts SID [Not Found]"
517) 546)
518 547
548dir /b /s /a:-d "!_Local!\Microsoft\Office\Licenses\*" %nul% && set sub_next=1
549dir /b /s /a:-d "!ProgramData!\Microsoft\Office\Licenses\*" %nul% && set sub_next=1
550
519for %%# in (!_sid! HKCU) do if not defined sub_next ( 551for %%# in (!_sid! HKCU) do if not defined sub_next (
520reg query %%#\Software\Microsoft\Office\16.0\Common\Licensing\LicensingNext /v MigrationToV5Done %nul2% | find /i "0x1" %nul% && ( 552reg query %%#\Software\Microsoft\Office\16.0\Common\Licensing\LicensingNext /v MigrationToV5Done %nul2% | find /i "0x1" %nul% && (
521reg query %%#\Software\Microsoft\Office\16.0\Common\Licensing\LicensingNext %nul2% | findstr /i "volume retail" %nul2% | findstr /i "0x2 0x3" %nul% && ( 553reg query %%#\Software\Microsoft\Office\16.0\Common\Licensing\LicensingNext %nul2% | findstr /i "volume retail" %nul2% | findstr /i "0x2 0x3" %nul% && (
@@ -524,11 +556,15 @@ set sub_next=1
524) 556)
525) 557)
526 558
527if defined sub_next for %%# in (!_sid! HKCU) do ( 559if defined sub_next (
560rmdir /s /q "!_Local!\Microsoft\Office\Licenses\" %nul%
561rmdir /s /q "!ProgramData!\Microsoft\Office\Licenses\" %nul%
562for %%# in (!_sid! HKCU) do (
528reg delete %%#\Software\Microsoft\Office\16.0\Common\Licensing /f %nul% 563reg delete %%#\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
529reg delete %%#\Software\Microsoft\Office\16.0\Common\Identity /f %nul% 564reg delete %%#\Software\Microsoft\Office\16.0\Common\Identity /f %nul%
530reg delete %%#\Software\Microsoft\Office\16.0\Registration /f %nul% 565reg delete %%#\Software\Microsoft\Office\16.0\Registration /f %nul%
531) 566)
567)
532 568
533if defined sub_next echo Removing Office vNext Block [Successful] 569if defined sub_next echo Removing Office vNext Block [Successful]
534 570
@@ -540,7 +576,7 @@ if defined sub_next echo Removing Office vNext Block [Successful]
540if defined o16c2r ( 576if defined o16c2r (
541for %%# in (!_sid! HKCU) do (reg delete %%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%) 577for %%# in (!_sid! HKCU) do (reg delete %%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%)
542for %%# in (!_sid! HKCU) do ( 578for %%# in (!_sid! HKCU) do (
543reg query %%# %nul% && ( 579reg query "%%#\Volatile Environment" %nul% && (
544reg add %%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul% 580reg add %%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
545) 581)
546) 582)
@@ -549,7 +585,7 @@ echo Adding Reg Keys To Skip License Check [Successful]
549 585
550::======================================================================================================================================== 586::========================================================================================================================================
551 587
552:: mass[]grave[.]dev/office-license-is-not-genuine.html 588:: mass grave[.]dev/office-license-is-not-genuine.html
553:: Add registry keys for volume products so that 'non-genuine' banner won't appear 589:: Add registry keys for volume products so that 'non-genuine' banner won't appear
554:: Script already is using MAK instead of GVLK so it won't appear anyway, but registry keys are added incase Office installs default GVLK grace key for volume products 590:: Script already is using MAK instead of GVLK so it won't appear anyway, but registry keys are added incase Office installs default GVLK grace key for volume products
555 591
@@ -671,7 +707,7 @@ echo:
671echo Deleting - Registry keys to skip license check 707echo Deleting - Registry keys to skip license check
672reg delete HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f 708reg delete HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
673 709
674for /f "tokens=* delims=" %%a in ('%psc% "$userSIDs = Get-WmiObject -Class Win32_UserAccount | ForEach-Object {write-host $_.SID}" %nul6%') do (if defined _sid (set "_sid=!_sid! %%a") else (set "_sid=%%a")) 710for /f "tokens=* delims=" %%a in ('%psc% "Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { Split-Path -Path $_.PSPath -Leaf }" %nul6%') do (if defined _sid (set "_sid=!_sid! %%a") else (set "_sid=%%a"))
675for %%# in (!_sid!) do (reg query HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && ( 711for %%# in (!_sid!) do (reg query HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && (
676reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f 712reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
677) 713)
@@ -740,10 +776,10 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %
740for /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) 776for /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)
741for /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) 777for /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)
742 778
743for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\OSPP.VBS" (set o16msi=1&set o16msi_reg=%_86%\16.0) 779for /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)
744for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\OSPP.VBS" (set o16msi=1&set o16msi_reg=%_68%\16.0) 780for /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)
745for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\OSPP.VBS" (set o15msi=1&set o15msi_reg=%_86%\15.0) 781for /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)
746for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\OSPP.VBS" (set o15msi=1&set o15msi_reg=%_68%\15.0) 782for /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)
747 783
748exit /b 784exit /b
749 785
@@ -778,7 +814,21 @@ exit /b
778 814
779if not defined _oLPath exit /b 815if not defined _oLPath exit /b
780 816
781set _License=%_prod:XVolume=XC2RVL_% 817if %oVer%==16 (
818"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%_key% %nul%
819) else (
820"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%_key% %nul%
821)
822
823call :oh_actids
824echo "!oapplist!" | find /i "!_actid!" %nul1% && (
825call :dk_color %Gray% "Installing Missing License Files [Office %oVer%.0 %_prod%] [Successful]"
826exit /b
827)
828
829:: Fallback to /ilc method to install licenses incase integrator.exe is not working
830
831set _License=%_License:XVolume=XC2RVL_%
782 832
783set _License=%_License:O365EduCloudRetail=O365EduCloudEDUR_% 833set _License=%_License:O365EduCloudRetail=O365EduCloudEDUR_%
784 834
@@ -787,6 +837,8 @@ set _License=%_License:ProjectStdRetail=ProjectStdO365R_%
787set _License=%_License:VisioProRetail=VisioProO365R_% 837set _License=%_License:VisioProRetail=VisioProO365R_%
788set _License=%_License:VisioStdRetail=VisioStdO365R_% 838set _License=%_License:VisioStdRetail=VisioStdO365R_%
789 839
840if defined _preview set _License=%_License:Volume=PreviewVL_%
841
790set _License=%_License:Retail=R_% 842set _License=%_License:Retail=R_%
791set _License=%_License:Volume=VL_% 843set _License=%_License:Volume=VL_%
792 844
@@ -800,9 +852,8 @@ cscript //nologo %windir%\system32\slmgr.vbs /ilc "!_oLPath!\%%~nx#" %nul%
800) 852)
801 853
802call :oh_actids 854call :oh_actids
803
804echo "!oapplist!" | find /i "!_actid!" %nul1% && ( 855echo "!oapplist!" | find /i "!_actid!" %nul1% && (
805call :dk_color %Gray% "Installing Missing License Files [Office %oVer%.0 %_prod%] [Successful]" 856call :dk_color %Gray% "Installing Missing License Files [Office %oVer%.0 %_prod%] [Successful with /ilc Method]"
806) || ( 857) || (
807set error=1 858set error=1
808call :dk_color %Red% "Installing Missing License Files [Office %oVer%.0 %_prod%] [Failed]" 859call :dk_color %Red% "Installing Missing License Files [Office %oVer%.0 %_prod%] [Failed]"
@@ -866,17 +917,23 @@ for %%# in (%_oIds%) do (
866set _key= 917set _key=
867set _actid= 918set _actid=
868set _lic= 919set _lic=
869set _prod=%%# 920set _preview=
921set _License=%%#
922
923echo %%# | find /i "2024" %nul% && (
924if exist "!_oLPath!\ProPlus2024PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus2024VL_*.xrm-ms" set _preview=-Preview
925)
926set _prod=%%#!_preview!
870 927
871call :ohookdata getinfo %%# 928call :ohookdata getinfo !_prod!
872 929
873if not [!_key!]==[] ( 930if not [!_key!]==[] (
874echo "!oapplist!" | find /i "!_actid!" %nul1% || call :oh_installlic 931echo "!oapplist!" | find /i "!_actid!" %nul1% || call :oh_installlic
875call :oh_installkey 932call :oh_installkey
876) else ( 933) else (
877set error=1 934set error=1
878call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 %%# not found in script]" 935call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
879echo Make sure you are using Latest MAS script. 936call :dk_color %Blue% "Make sure you are using Latest MAS script."
880) 937)
881) 938)
882 939
@@ -1023,7 +1080,11 @@ set _corrupt=
1023sc start %%# %nul% 1080sc start %%# %nul%
1024if !errorlevel! EQU 1060 set _corrupt=1 1081if !errorlevel! EQU 1060 set _corrupt=1
1025sc query %%# %nul% || set _corrupt=1 1082sc query %%# %nul% || set _corrupt=1
1026for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1) 1083for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
1084reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1
1085if /i %%#==TrustedInstaller if /i %%G==DependOnService set _corrupt=
1086)
1087
1027if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (set "serv_cor=%%#")) 1088if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (set "serv_cor=%%#"))
1028) 1089)
1029 1090
@@ -1049,13 +1110,18 @@ set serv_cste=
1049 1110
1050if defined serv_ste ( 1111if defined serv_ste (
1051for %%# in (%serv_ste%) do ( 1112for %%# in (%serv_ste%) do (
1052if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) 1113if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%)
1053if /i %%#==wlidsvc sc config %%# start= demand %nul% 1114if /i %%#==wlidsvc sc config %%# start= demand %nul%
1054if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) 1115if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%)
1055if /i %%#==KeyIso sc config %%# start= demand %nul% 1116if /i %%#==KeyIso sc config %%# start= demand %nul%
1056if /i %%#==LicenseManager sc config %%# start= demand %nul% 1117if /i %%#==LicenseManager sc config %%# start= demand %nul%
1057if /i %%#==Winmgmt sc config %%# start= auto %nul% 1118if /i %%#==Winmgmt sc config %%# start= auto %nul%
1058if /i %%#==wuauserv sc config %%# start= demand %nul% 1119if /i %%#==DoSvc sc config %%# start= delayed-auto %nul%
1120if /i %%#==UsoSvc sc config %%# start= delayed-auto %nul%
1121if /i %%#==CryptSvc sc config %%# start= auto %nul%
1122if /i %%#==BITS sc config %%# start= delayed-auto %nul%
1123if /i %%#==wuauserv sc config %%# start= demand %nul%
1124if /i %%#==WaaSMedicSvc sc config %%# start= demand %nul%
1059if !errorlevel!==0 ( 1125if !errorlevel!==0 (
1060if defined serv_csts (set "serv_csts=!serv_csts! %%#") else (set "serv_csts=%%#") 1126if defined serv_csts (set "serv_csts=!serv_csts! %%#") else (set "serv_csts=%%#")
1061) else ( 1127) else (
@@ -1080,9 +1146,12 @@ set serv_e=
1080for %%# in (%_serv%) do ( 1146for %%# in (%_serv%) do (
1081set errorcode= 1147set errorcode=
1082set checkerror= 1148set checkerror=
1083net start %%# /y %nul% 1149
1150sc query %%# | find /i "RUNNING" %nul% || (
1151%psc% Start-Service %%# %nul%
1084set errorcode=!errorlevel! 1152set errorcode=!errorlevel!
1085sc query %%# | find /i "RUNNING" %nul% || set checkerror=1 1153sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
1154)
1086 1155
1087sc start %%# %nul% 1156sc start %%# %nul%
1088if !errorlevel! NEQ 1056 if !errorlevel! NEQ 0 (set errorcode=!errorlevel!&set checkerror=1) 1157if !errorlevel! NEQ 1056 if !errorlevel! NEQ 0 (set errorcode=!errorlevel!&set checkerror=1)
@@ -1093,7 +1162,7 @@ if defined serv_e (
1093set error=1 1162set error=1
1094call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" 1163call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
1095echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && ( 1164echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
1096call :dk_color %Blue% "Restart the system to fix disabled service error 1058." 1165call :dk_color %Blue% "Restart the system to fix this error."
1097set showfix=1 1166set showfix=1
1098) 1167)
1099) 1168)
@@ -1105,14 +1174,18 @@ set showfix=1
1105if defined safeboot_option ( 1174if defined safeboot_option (
1106set error=1 1175set error=1
1107set showfix=1 1176set showfix=1
1108call :dk_color2 %Red% "Checking Boot Mode " %Blue% "[Safe mode found. Run in normal mode.]" 1177call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode found. Run in normal mode.]"
1109) 1178)
1110 1179
1111 1180
1112reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" %nul2% | find /i "IMAGE_STATE_COMPLETE" %nul1% || ( 1181for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
1182if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
1113set error=1 1183set error=1
1184call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
1185echo "%imagestate%" | find /i "RESEAL" %nul% && (
1114set showfix=1 1186set showfix=1
1115call :dk_color2 %Red% "Checking Audit Mode " %Blue% "[IMAGE_STATE_COMPLETE status not found. Run in normal mode.]" 1187call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
1188)
1116) 1189)
1117 1190
1118 1191
@@ -1123,18 +1196,60 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
1123) 1196)
1124 1197
1125 1198
1126%psc% $ExecutionContext.SessionState.LanguageMode %nul2% | find /i "Full" %nul1% || ( 1199set wpainfo=
1200set wpaerror=
1201for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1]);" %nul6%') do (set wpainfo=%%a)
1202echo "%wpainfo%" | find /i "Error Found" %nul% && (
1127set error=1 1203set error=1
1128call :dk_color %Red% "Checking Powershell [Not Responding]" 1204set wpaerror=1
1205call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
1206) || (
1207echo Checking WPA Registry Count [%wpainfo%]
1129) 1208)
1130 1209
1131 1210
1132DISM /English /Online /Get-CurrentEdition %nul% 1211DISM /English /Online /Get-CurrentEdition %nul%
1133set dism_error=%errorlevel% 1212set dism_error=%errorlevel%
1134cmd /c exit /b %dism_error% 1213cmd /c exit /b %dism_error%
1135if %dism_error% NEQ 0 set "dism_error=[0x%=ExitCode%]" 1214if %dism_error% NEQ 0 set "dism_error=0x%=ExitCode%"
1136if %dism_error% NEQ 0 ( 1215if %dism_error% NEQ 0 (
1137call :dk_color %Red% "Checking DISM [Not Responding] %dism_error%" 1216call :dk_color %Red% "Checking DISM [Not Responding] [%dism_error%]"
1217)
1218
1219
1220if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
1221set error=1
1222set showfix=1
1223call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
1224call :dk_color %Blue% "Evaluation Windows can not be activated and different License install may lead to errors."
1225call :dk_color %Blue% "It is recommended to install full version of %winos%."
1226call :dk_color %Blue% "You can download it from %mas%genuine-installation-media.html"
1227)
1228
1229
1230set osedition=
1231for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
1232
1233:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
1234
1235if "%osSKU%"=="164" set osedition=ProfessionalEducation
1236if "%osSKU%"=="165" set osedition=ProfessionalEducationN
1237
1238if not defined officeact (
1239if not defined osedition (
1240call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
1241) else (
1242
1243if not exist "%SystemRoot%\System32\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" (
1244set error=1
1245call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
1246)
1247
1248if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
1249set error=1
1250call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
1251)
1252)
1138) 1253)
1139 1254
1140 1255
@@ -1167,6 +1282,13 @@ set showfix=1
1167) 1282)
1168 1283
1169 1284
1285%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
1286set /a "sum/=3"
1287if not defined officeact if not "%sum%"=="%slcSKU%" (
1288call :dk_color %Red% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
1289)
1290
1291
1170reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( 1292reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
1171set error=1 1293set error=1
1172set showfix=1 1294set showfix=1
@@ -1184,8 +1306,7 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
1184for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( 1306for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
1185reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% 1307reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
1186call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" 1308call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
1187net stop sppsvc /y %nul% 1309%psc% Restart-Service sppsvc %nul%
1188net start sppsvc /y %nul%
1189set error=1 1310set error=1
1190) 1311)
1191 1312
@@ -1215,7 +1336,7 @@ call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Creat
1215 1336
1216call :dk_actids 1337call :dk_actids
1217if not defined applist ( 1338if not defined applist (
1218net stop sppsvc /y %nul% 1339%psc% Stop-Service sppsvc %nul%
1219cscript //nologo %windir%\system32\slmgr.vbs /rilc %nul% 1340cscript //nologo %windir%\system32\slmgr.vbs /rilc %nul%
1220if !errorlevel! NEQ 0 cscript //nologo %windir%\system32\slmgr.vbs /rilc %nul% 1341if !errorlevel! NEQ 0 cscript //nologo %windir%\system32\slmgr.vbs /rilc %nul%
1221call :dk_refresh 1342call :dk_refresh
@@ -1240,25 +1361,9 @@ call :dk_color %Red% "Checking sppsvc.exe File [Not Found]"
1240) 1361)
1241 1362
1242 1363
1243:: Below checks are performed if required services are not disabled or corrupted + if there is any error + slmgr /dlv errorlevel is not Zero + no fix was shown before 1364:: This code checks if NT SERVICE\sppsvc has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
1244 1365
1245set wpaerror=
1246set permerror= 1366set permerror=
1247if not defined serv_cor if not defined serv_cste if defined error if /i not %error_code%==0 if not defined showfix (
1248
1249REM This code checks for invalid registry keys in HKLM\SYSTEM\WPA. This issue may appear even on healthy systems.
1250
1251if %winbuild% GEQ 14393 (
1252set /a count=0
1253for /f %%a in ('reg query "HKLM\SYSTEM\WPA" %nul6%') do set /a count+=1
1254for /L %%# in (1,1,!count!) do (
1255reg query "HKLM\SYSTEM\WPA\8DEC0AF1-0341-4b93-85CD-72606C2DF94C-7P-%%#" /ve /t REG_BINARY %nul% || set wpaerror=1
1256)
1257if defined wpaerror call :dk_color %Red% "Checking WPA Registry Keys [Error Found] [Registry Count - !count!]"
1258)
1259
1260REM This code checks if NT SERVICE\sppsvc has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
1261
1262if not exist "%tokenstore%\" set permerror=1 1367if not exist "%tokenstore%\" set permerror=1
1263 1368
1264for %%# in ( 1369for %%# in (
@@ -1269,15 +1374,65 @@ for %%# in (
1269%psc% "$acl = Get-Acl '%%#'; if ($acl.Access.Where{ $_.IdentityReference -eq 'NT SERVICE\sppsvc' -and $_.AccessControlType -eq 'Deny' -or $acl.Access.IdentityReference -notcontains 'NT SERVICE\sppsvc'}) {Exit 2}" %nul% 1374%psc% "$acl = Get-Acl '%%#'; if ($acl.Access.Where{ $_.IdentityReference -eq 'NT SERVICE\sppsvc' -and $_.AccessControlType -eq 'Deny' -or $acl.Access.IdentityReference -notcontains 'NT SERVICE\sppsvc'}) {Exit 2}" %nul%
1270if !errorlevel!==2 set permerror=1 1375if !errorlevel!==2 set permerror=1
1271) 1376)
1272if defined permerror call :dk_color %Red% "Checking SPP Permissions [Error Found]" 1377if defined permerror (
1378set error=1
1379set showfix=1
1380call :dk_color %Red% "Checking SPP Permissions [Error Found]"
1381call :dk_color %Blue% "%_fixmsg%"
1382)
1383
1273 1384
1385:: If required services are not disabled or corrupted + if there is any error + slmgr /dlv errorlevel is not Zero + no fix was shown before
1386
1387if not defined serv_cor if not defined serv_cste if defined error if /i not %error_code%==0 if not defined showfix (
1274set showfix=1 1388set showfix=1
1275call :dk_color %Blue% "%_fixmsg%" 1389call :dk_color %Blue% "%_fixmsg%"
1276if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option." 1390if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
1277) 1391)
1278 1392
1393if not defined showfix if defined wpaerror (
1394set showfix=1
1395call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
1396)
1397
1279exit /b 1398exit /b
1280 1399
1400:: This code checks for invalid registry keys in HKLM\SYSTEM\WPA. This issue may appear even on healthy systems
1401
1402:wpatest:
1403$wpaKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey("SYSTEM\\WPA")
1404$count = $wpaKey.SubKeyCount
1405
1406$osVersion = [System.Environment]::OSVersion.Version
1407$minBuildNumber = 14393
1408
1409if ($osVersion.Build -ge $minBuildNumber) {
1410 $subkeyHashTable = @{}
1411 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
1412 $keyNumber = $subkeyName -replace '.*-', ''
1413 $subkeyHashTable[$keyNumber] = $true
1414 }
1415 for ($i=1; $i -le $count; $i++) {
1416 if (-not $subkeyHashTable.ContainsKey("$i")) {
1417 Write-Host "Total Keys $count. Error Found- $i key does not exist"
1418 $wpaKey.Close()
1419 exit
1420 }
1421 }
1422}
1423$wpaKey.GetSubKeyNames() | ForEach-Object {
1424 $subkey = $wpaKey.OpenSubKey($_)
1425 $p = $subkey.GetValueNames()
1426 if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
1427 Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
1428 $wpaKey.Close()
1429 exit
1430 }
1431}
1432$count
1433$wpaKey.Close()
1434:wpatest:
1435
1281::======================================================================================================================================== 1436::========================================================================================================================================
1282 1437
1283:dk_color 1438:dk_color
@@ -1481,6 +1636,9 @@ for %%# in (
148116_d55f90ee-4ba2-4d02-b216-1300ee50e2af_BW%f%43B-4P%f%NFP-V63%f%7F-23%f%TR2-J47%f%TX_MAK-AE________VisioStd2021Volume 163616_d55f90ee-4ba2-4d02-b216-1300ee50e2af_BW%f%43B-4P%f%NFP-V63%f%7F-23%f%TR2-J47%f%TX_MAK-AE________VisioStd2021Volume
148216_fb33d997-4aa3-494e-8b58-03e9ab0f181d_VN%f%CC4-CJ%f%QVK-BKX%f%34-77%f%Y8H-CYX%f%MR_Retail________Word2021Retail 163716_fb33d997-4aa3-494e-8b58-03e9ab0f181d_VN%f%CC4-CJ%f%QVK-BKX%f%34-77%f%Y8H-CYX%f%MR_Retail________Word2021Retail
148316_0c728382-95fb-4a55-8f12-62e605f91727_BJ%f%G97-NW%f%3GM-8QQ%f%Q7-FH%f%76G-686%f%XM_MAK-AE________Word2021Volume 163816_0c728382-95fb-4a55-8f12-62e605f91727_BJ%f%G97-NW%f%3GM-8QQ%f%Q7-FH%f%76G-686%f%XM_MAK-AE________Word2021Volume
163916_8fdb1f1e-663f-4f2e-8fdb-7c35aee7d5ea_GN%f%XWX-DF%f%797-B2J%f%T3-82%f%W27-KHP%f%XT_MAK-AE________ProPlus2024Volume-Preview
164016_33b11b14-91fd-4f7b-b704-e64a055cf601_X8%f%6XX-N3%f%QMW-B4W%f%GQ-QC%f%B69-V26%f%KW_MAK_AE________ProjectPro2024Volume-Preview
164116_eb074198-7384-4bdd-8e6c-c3342dac8435_DW%f%99Y-H7%f%NT6-6B2%f%9D-8J%f%Q8F-R3Q%f%T7_MAK_AE________VisioPro2024Volume-Preview
148416_6337137e-7c07-4197-8986-bece6a76fc33_2P%f%3C9-BQ%f%NJH-VCV%f%PH-YD%f%Y6M-43J%f%PQ_Subscription__O365BusinessRetail 164216_6337137e-7c07-4197-8986-bece6a76fc33_2P%f%3C9-BQ%f%NJH-VCV%f%PH-YD%f%Y6M-43J%f%PQ_Subscription__O365BusinessRetail
148516_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W6%f%2NQ-26%f%7QR-RTF%f%74-PF%f%2MH-JQM%f%TH_Subscription__O365EduCloudRetail 164316_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W6%f%2NQ-26%f%7QR-RTF%f%74-PF%f%2MH-JQM%f%TH_Subscription__O365EduCloudRetail
148616_537ea5b5-7d50-4876-bd38-a53a77caca32_J2%f%W28-TN%f%9C8-26P%f%WV-F7%f%J4G-72X%f%CB_Subscription1_O365HomePremRetail 164416_537ea5b5-7d50-4876-bd38-a53a77caca32_J2%f%W28-TN%f%9C8-26P%f%WV-F7%f%J4G-72X%f%CB_Subscription1_O365HomePremRetail
@@ -1516,8 +1674,8 @@ exit /b
1516 1674
1517:oh_extractdll 1675:oh_extractdll
1518 1676
1519set _blank= 1677set b=
1520%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$bytes = [Con%_blank%vert]::FromBas%_blank%e64String($f[1]); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1]);" %nul2% | find /i "Error found" %nul1% && set hasherror=1 1678%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$bytes = [Con%b%vert]::FromBas%b%e64String($f[1]); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1]);" %nul2% | find /i "Error found" %nul1% && set hasherror=1
1521exit /b 1679exit /b
1522 1680
1523:hexedit: 1681:hexedit:
@@ -1600,13 +1758,13 @@ $MemoryStream.Close()
1600:: 1758::
1601:: The files are encoded in base64 to make MAS AIO version. 1759:: The files are encoded in base64 to make MAS AIO version.
1602:: 1760::
1603:: mass[]grave[.]dev/ohook 1761:: mass grave[.]dev/ohook
1604:: Here you can find the files source code and info on how to rebuild the identical sppc.dll files 1762:: Here you can find the files source code and info on how to rebuild the identical sppc.dll files
1605:: 1763::
1606:: stackoverflow.com/a/35335273 1764:: stackoverflow.com/a/35335273
1607:: Here you can check how to extract sppc.dll files from base64 1765:: Here you can check how to extract sppc.dll files from base64
1608:: 1766::
1609:: For any further question, feel free to contact us on mass[]grave[.]dev/contactus 1767:: For any further question, feel free to contact us on mass grave[.]dev/contactus
1610:: 1768::
1611::======================================================================================================================================== 1769::========================================================================================================================================
1612 1770