29 Commits

Author SHA1 Message Date
d940db1e60 export-ignore 2025-09-12 06:18:45 +05:30
ab6b572af9 3.7 2025-09-12 05:42:18 +05:30
75a4d2e3a7 Generate ticket by signing the ticket 2025-09-12 05:26:24 +05:30
fd2cecb4ec Revert export-ignore 2025-09-10 04:58:37 +05:30
a9c2f58741 export-ignore 2025-09-10 04:18:00 +05:30
79012c7db0 3.6 2025-09-10 04:16:01 +05:30
caffa62abe Fixed an issue with TSforge caused by updated pkeyconfig on 22631.5840. Thanks to WitherOrNot for the fix. 2025-09-10 01:44:23 +05:30
a8f6d051a6 Change TSforge to use StaticCID only on build 26100 and above 2025-09-10 00:57:04 +05:30
6022b6de10 Use ComObject instead of Get-ScheduledTask for more reliability, improve info 2025-09-10 00:33:30 +05:30
4ea26906cd Add Outlook 2010 Retail key, thanks to celestial_tiger_98134 2025-09-06 03:09:24 +05:30
564aad78b4 Evade detection 2025-09-06 02:34:53 +05:30
d5e382e763 Revert export-ignore 2025-08-11 02:48:26 +05:30
793550725a export-ignore 2025-08-11 02:36:40 +05:30
3917497c82 3.5 2025-08-11 02:29:59 +05:30
28c2264d89 Change arg to detect no relaunch to change process 2025-08-11 01:39:53 +05:30
a51ae62332 Update README, don't relaunch if unattended mode found 2025-08-10 17:22:28 +05:30
ffcb641f17 Fix a typo 2025-08-08 22:14:21 +05:30
53a2747338 Fix redirection issue on W10 ARM64 2025-08-07 17:43:26 +05:30
3a99ea4eeb Fix build version detection on XP and older 2025-08-07 02:43:05 +05:30
e6eaeaa682 Detect vnext license and show info 2025-08-07 01:50:09 +05:30
e2c52b4ac8 Some more minor changes 2025-08-04 21:30:05 +05:30
31c47b9538 Minor changes 2025-08-04 21:03:49 +05:30
904e96d748 Check .NET corruption 2025-08-04 02:05:13 +05:30
5e2cc4f5cf Update sandbox detection code 2025-08-03 04:10:11 +05:30
c619a2c381 Add a message about KMS renewal notification in 26200 2025-08-03 03:28:06 +05:30
9c09432b01 Update error message 2025-08-03 01:49:35 +05:30
e476ac66a4 Detect Windows Sandbox 2025-08-03 01:45:30 +05:30
dba7213a91 Fix a typo 2025-08-02 22:06:03 +05:30
0f38fa3cef Streamline diagnostic tests 2025-08-02 21:59:38 +05:30
12 changed files with 3560 additions and 1718 deletions

6
.gitattributes vendored
View File

@ -1,4 +1,4 @@
# MAS export-ignore MAS export-ignore
# LICENSE export-ignore LICENSE export-ignore
# README.md export-ignore README.md export-ignore
.gitattributes export-ignore .gitattributes export-ignore

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -50,6 +50,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -173,6 +174,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected; activation is not supported.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto dk_done
)
)
if %winbuild% LSS 6001 ( if %winbuild% LSS 6001 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -269,6 +280,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done goto dk_done
) )
@ -283,13 +297,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto dk_done goto dk_done
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -701,7 +728,7 @@ call :dk_color %Gray% "Checking Old Office With Sub License [Found. Update Of
::======================================================================================================================================== ::========================================================================================================================================
:: mass<>grave<.>dev/office-license-is-not-genuine :: mass()grave(dot)dev/office-license-is-not-genuine
:: Add registry keys for volume products so that 'non-genuine' banner won't appear :: Add registry keys for volume products so that 'non-genuine' banner won't appear
:: 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 :: 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
@ -743,7 +770,7 @@ if defined ohub call :dk_color %Gray% "Office apps such as Word, Excel are activ
echo Help: %mas%troubleshoot echo Help: %mas%troubleshoot
) else ( ) else (
call :dk_color %Red% "Some errors were detected." call :dk_color %Red% "Some errors were detected."
if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%" if not defined ierror if not defined showfix call :dk_color %Blue% "%_fixmsg%"
echo: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
@ -1448,10 +1475,12 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
:: Clear the vNext/shared/device license blocks which may prevent ohook activation :: Clear the vNext/shared/device license blocks which may prevent ohook activation
set vnextexist=
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul% rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
for %%x in (15 16) do ( for %%x in (15 16) do (
for %%# in (%_sidlist%) do ( for %%# in (%_sidlist%) do (
reg query HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul% reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do ( for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
@ -1474,6 +1503,7 @@ rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\L
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" ( if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
set defname=DEFTEMP-%%# set defname=DEFTEMP-%%#
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul% reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
reg query HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul% reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
reg unload HKU\!defname! %nul% reg unload HKU\!defname! %nul%
) )
@ -1481,6 +1511,15 @@ reg unload HKU\!defname! %nul%
) )
) )
if defined vnextexist (
echo:
call :dk_color %Gray% "Office vNext subscription detected:"
call :dk_color %Blue% "If active, this license overrides other activation methods."
call :dk_color %Blue% "If expiring soon, rerun the script after expiration."
call :dk_color2 %Blue% "If expired and script activation fails, get help - " %_Yellow% " %mas%troubleshoot"
echo:
)
:: Clear SharedComputerLicensing for office :: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation :: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1575,7 +1614,15 @@ set upk_result=2
if defined ohookact if not %upk_result%==0 echo: if defined ohookact if not %upk_result%==0 echo:
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful] if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]" if %upk_result%==2 (
call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
echo:
set showfix=1
)
)
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1628,7 +1675,7 @@ exit /b
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
@ -1717,9 +1764,11 @@ if %sps%==SoftwareLicensingService call :dk_refresh
echo %keyecho% %~1 [Successful] echo %keyecho% %~1 [Successful]
) else ( ) else (
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error ( if not defined showfix (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key." if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
echo:
call :dk_color %Blue% "%_fixmsg%" call :dk_color %Blue% "%_fixmsg%"
echo:
set showfix=1 set showfix=1
) )
set error=1 set error=1
@ -1873,6 +1922,7 @@ if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%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% "Checking Probable Mal%w%ware Infection..."
if defined results (call :dk_color %Red% "%results%"&set showfix=1) if defined results (call :dk_color %Red% "%results%"&set showfix=1)
echo:
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -1893,40 +1943,118 @@ exit /b
set showfix= set showfix=
call :dk_chkmal call :dk_chkmal
::==============================
:: Check Sandboxing :: Check Sandboxing
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly]"
set showfix=1 if not defined showfix (
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]" echo:
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
set error=1
set showfix=1
)
::======================================================================================================================================== ::==============================
:: Check WinPE mode
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
call :dk_color %Red% "Checking WinPE [Found]"
if not defined showfix (
echo:
call :dk_color %Blue% "WinPE mode found. Reboot the system and run in normal mode."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check Safe mode
if defined safeboot_option (
call :dk_color %Red% "Checking Boot Mode [%safeboot_option%]"
if not defined showfix (
echo:
call :dk_color %Blue% "Safe mode found. Reboot the system and run in normal mode."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check ImageState
:: 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)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
if not defined showfix (
echo:
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
echo:
)
set error=1
set showfix=1
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
)
)
::==============================
:: Check corrupt services :: Check corrupt services
set serv_cor= set serv_cor=
for %%# in (%_serv%) do ( for %%# in (%_serv%) do (
set _regcorr=
set _corrupt= set _corrupt=
sc start %%# %nul% sc start %%# %nul%
if !errorlevel! EQU 1060 set _corrupt=1 if !errorlevel! EQU 1060 set _corrupt=1
sc query %%# %nul% || set _corrupt=1 sc query %%# %nul% || set _corrupt=1
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt ( for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _regcorr (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1 reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1&set _regcorr=-RegistryError)
) )
if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (set "serv_cor=%%#")) if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#!_regcorr!") else (set "serv_cor=%%#!_regcorr!"))
) )
if defined serv_cor ( if defined serv_cor (
set error=1
set showfix=1
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]" call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
if not defined showfix (
echo:
if /i "%serv_cor%"=="sppsvc-RegistryError" (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
) else (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
)
echo:
) )
::======================================================================================================================================== set error=1
set showfix=1
)
::==============================
:: Check disabled services :: Check disabled services
@ -1961,11 +2089,26 @@ if defined serv_cste (set "serv_cste=!serv_cste! %%#") else (set "serv_cste=%%#"
if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]" if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]"
if defined serv_cste ( if defined serv_cste (
set error=1
call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]" call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]"
if not defined showfix (
echo:
echo %serv_cste% | findstr /i "ClipSVC sppsvc" %nul% && (
echo A registry fix has been applied to enable the disabled service.
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) || (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
)
echo:
) )
::======================================================================================================================================== set error=1
set showfix=1
)
::==============================
:: Check if the services are able to run or not :: Check if the services are able to run or not
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions :: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
@ -1987,119 +2130,25 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
) )
if defined serv_e ( if defined serv_e (
set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." if not defined showfix (
set listwospp=%_serv:sppsvc=%
echo %serv_e% | findstr /i "!listwospp!" %nul% && (
set showfix=1 set showfix=1
) echo:
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
:: Various error checks
if defined safeboot_option (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode found. Run in normal mode.]"
)
:: 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)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
set fixes=%fixes% %mas%in-place_repair_upgrade set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "If service error is still not fixed, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
) )
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
set error=1 set error=1
set showfix=1
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
) )
::==============================
set wpainfo= :: Check WMI
set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1
set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || (
echo Checking WPA Registry Count [%wpainfo%]
)
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
)
)
set osedition=0
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
if not %osedition%==0 (
if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
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%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
if %error_code% NEQ 0 (
set error=1
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
)
set wmifailed= set wmifailed=
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
@ -2107,168 +2156,94 @@ if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Objec
if %errorlevel% NEQ 0 set wmifailed=1 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
if not defined showfix call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
set showfix=1
)
if not defined showfix (
if not defined notwinact ( echo:
if %winbuild% GEQ 10240 ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%" echo:
set /a "sum/=3"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
) )
) else (
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
set /a "sum/=2"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
::==============================
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( :: Check SPP Registry Key
set error=1
set showfix=1
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
)
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
echo Checking Eval WLMS Service [Found]
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
)
if defined _sppint (
echo %_sppint% | find /i "PerfOptions" %nul% && (
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
set showfix=1
) || (
echo Checking SPP In IFEO [%_sppint%]
)
)
if %winbuild% GEQ 7600 for /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 (
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
echo:
)
set error=1 set error=1
set showfix=1 set showfix=1
) )
::==============================
:: Check TokenStore registry key
set tokenstore= set tokenstore=
if %winbuild% GEQ 7600 ( if %winbuild% GEQ 7600 (
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" ( if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set toerr=1 set toerr=1
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
) )
) )
::==============================
:: This code creates token folder only if it's missing and sets default permission for it :: This code creates token folder only if it's missing and sets default permission for it
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
mkdir "%tokenstore%" %nul% mkdir "%tokenstore%" %nul%
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;" set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;"
set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);" set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set error=1 set error=1
set showfix=1 set showfix=1
) )
) )
::==============================
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
set error=1
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
)
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 if not defined toerr if not defined ps32onArm if exist "%tokenstore%\" (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -2296,29 +2271,299 @@ if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
if defined permerror ( if defined permerror (
set error=1
call :dk_color %Red% "Checking SPP Permissions [!permerror!]" call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
set showfix=1
)
)
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
if not defined serv_cor if not defined serv_cste if defined error if /i not %error_code%==0 if not defined showfix (
if not defined permerror if defined wpaerror (call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option." & set showfix=1)
if not defined showfix ( if not defined showfix (
set showfix=1 echo:
call :dk_color %Blue% "%_fixmsg%" call :dk_color %Blue% "%_fixmsg%"
if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option." echo:
)
set error=1
set showfix=1
) )
) )
if not defined showfix if defined wpaerror ( ::==============================
:: Check WPA Registry Errors
set chkalp=
set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp (
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
if not defined showfix (
echo "%wpainfo%" | find /i "Error Found" %nul% && (
echo:
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
echo:
set error=1
set showfix=1 set showfix=1
call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
) )
)
set wpainfo=a
)
if not defined chkalp (
if %wpainfo% GEQ 5000 (
call :dk_color %Gray% "Checking WPA Registry Count [%wpainfo%]"
echo:
call :dk_color %Blue% "A large number of WPA registries have been found, which may cause high CPU usage."
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
echo:
) else (
echo Checking WPA Registry Count [%wpainfo%]
)
)
::==============================
:: Check Rearm
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
if not defined showfix (
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
echo:
)
set error=1
set showfix=1
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
if not defined showfix (
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check SoftwareLicensingService
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%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
if %error_code% NEQ 0 (
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] [%error_code%]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check Activation IDs
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
)
if not defined apps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps if defined allapps if not defined notwinact (
call :dk_color %Gray% "Checking Activation IDs [Key Not Installed or Act ID Not Found]"
)
if not defined apps if not defined allapps (
call :dk_color %Red% "Checking Activation IDs [Not found]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
set error=1
set showfix=1
)
if not defined showfix if defined rlicfailed (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
)
::==============================
:: Check Eval Windows
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
call :dk_color %Red% "Checking Eval Packages [License swapping found. Non-Eval licenses are installed in Eval Windows]"
if not defined showfix (
echo:
call :dk_color %Blue% "License swapping is not the right way to upgrade to the full version. Learn the correct method at the link below."
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
echo:
)
set error=1
set showfix=1
)
)
::==============================
:: Check HKU\S-1-5-20\Software registry, in some systems it's missing and that causes Windows activation problems
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check license and package files for the current edition
set osedition=0
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
if not %osedition%==0 (
if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
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%]"
)
)
)
)
::==============================
:: Check SKU value to find if there is any difference
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
)
) else (
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
set /a "sum/=2"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
)
)
)
::==============================
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
echo Checking Eval WLMS Service [Found]
)
::==============================
:: Check SPP interference in IFEO
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
)
if defined _sppint (
echo %_sppint% | find /i "PerfOptions" %nul% && (
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
echo:
)
set showfix=1
) || (
echo Checking SPP In IFEO [%_sppint%]
)
)
::==============================
:: Check and fix SkipRearm registry value
if %winbuild% GEQ 7600 for /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 (
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Gray% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
::==============================
:: Check SvcRestartTask status, this task helps in making sure system remains activated
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Gray% "Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.]"
if not defined showfix (
echo:
echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
) || (
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
)
echo:
)
)
)
)
::==============================
exit /b exit /b
@ -2441,7 +2686,6 @@ exit /b
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR] 14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR]
14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR 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_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR]
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR] 14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR]
14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR] 14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR]
@ -2470,6 +2714,7 @@ for %%# in (
14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL 14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR] 14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR]
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL 14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL
14_fbf4ac36-31c8-4340-8666-79873129cf40_9D8FR-7GYBW-4YG8M-V36JK-VD%f%7CM_Retail________OutlookR
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL 14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL
14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR] 14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR]
14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL 14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL
@ -2988,13 +3233,13 @@ $MemoryStream.Close()
:: ::
:: The files are encoded in base64 to make AIO version. :: The files are encoded in base64 to make AIO version.
:: ::
:: mass<>grave<.>dev/ohook :: mass()grave(dot)dev/ohook
:: Here you can find the files source code and info on how to rebuild the identical sppc.dll files :: Here you can find the files source code and info on how to rebuild the identical sppc.dll files
:: ::
:: stackoverflow.com/a/35335273 :: stackoverflow.com/a/35335273
:: Here you can check how to extract sppc.dll files from base64 :: Here you can check how to extract sppc.dll files from base64
:: ::
:: For any further question, feel free to contact us on mass<>grave<.>dev/contactus :: For any further question, feel free to contact us on mass()grave(dot)dev/contactus
:: ::
::======================================================================================================================================== ::========================================================================================================================================
:: ::

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -75,6 +75,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -204,6 +205,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected; activation is not supported.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto dk_done
)
)
if %winbuild% LSS 6001 ( if %winbuild% LSS 6001 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -300,6 +311,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done goto dk_done
) )
@ -314,13 +328,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto dk_done goto dk_done
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -1004,7 +1031,7 @@ if %winbuild% GEQ 9200 (
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1" for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1"
for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath /reg:32" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1" for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath /reg:32" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" set "_C16R=1"
if defined _C16R ( if defined _C16R (
REM mass<>grave<.>dev/office-license-is-not-genuine REM mass()grave(dot)dev/office-license-is-not-genuine
set _server=10.0.0.10 set _server=10.0.0.10
call :_taskregserv call :_taskregserv
echo Keeping the non-existent IP address 10.0.0.10 as %KS% Server. echo Keeping the non-existent IP address 10.0.0.10 as %KS% Server.
@ -1426,10 +1453,12 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
:: Clear the vNext/shared/device license blocks which may prevent ohook activation :: Clear the vNext/shared/device license blocks which may prevent ohook activation
set vnextexist=
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul% rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
for %%x in (15 16) do ( for %%x in (15 16) do (
for %%# in (%_sidlist%) do ( for %%# in (%_sidlist%) do (
reg query HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul% reg delete HKU\%%#\Software\Microsoft\Office\%%x.0\Common\Licensing /f %nul%
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do ( for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
@ -1452,6 +1481,7 @@ rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\L
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" ( if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
set defname=DEFTEMP-%%# set defname=DEFTEMP-%%#
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul% reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
reg query HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /s %nul2% | findstr /i "CIDToLicenseIdsMapping LicenseIdToEmailMapping @" %nul% && set vnextexist=1
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul% reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
reg unload HKU\!defname! %nul% reg unload HKU\!defname! %nul%
) )
@ -1459,6 +1489,15 @@ reg unload HKU\!defname! %nul%
) )
) )
if defined vnextexist (
echo:
call :dk_color %Gray% "Office vNext subscription detected:"
call :dk_color %Blue% "If active, this license overrides other activation methods."
call :dk_color %Blue% "If expiring soon, rerun the script after expiration."
call :dk_color2 %Blue% "If expired and script activation fails, get help - " %_Yellow% " %mas%troubleshoot"
echo:
)
:: Clear SharedComputerLicensing for office :: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation :: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1553,7 +1592,15 @@ set upk_result=2
if defined ohookact if not %upk_result%==0 echo: if defined ohookact if not %upk_result%==0 echo:
if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful] if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
if %upk_result%==2 call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]" if %upk_result%==2 (
call :dk_color %Red% "Uninstalling Other/Grace Keys [Failed]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
echo:
set showfix=1
)
)
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1602,6 +1649,9 @@ call :ks_clearstuff
set error_=9 set error_=9
echo Failed to completely clear %KS% Cache. echo Failed to completely clear %KS% Cache.
reg query "HKLM\%SPPk%\%_wApp%" /s %nul2% | findstr /i "127.0.0.2" %nul1% && echo KMS38 activation is locked. reg query "HKLM\%SPPk%\%_wApp%" /s %nul2% | findstr /i "127.0.0.2" %nul1% && echo KMS38 activation is locked.
echo:
call :dk_color %Blue% "%_fixmsg%"
echo:
) || ( ) || (
echo Cleared %KS% Cache successfully. echo Cleared %KS% Cache successfully.
) )
@ -1617,6 +1667,10 @@ echo %uline%
echo %uline% echo %uline%
echo: echo:
call :dk_color %Green% "Online %KS% has been successfully uninstalled." call :dk_color %Green% "Online %KS% has been successfully uninstalled."
echo:
call :dk_color %Gray% "If you want to reset the activation status,"
call :dk_color %Blue% "%_fixmsg%"
echo:
echo %uline% echo %uline%
) )
@ -1673,7 +1727,7 @@ exit /b
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -1714,7 +1768,7 @@ set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowe
set _tserror= set _tserror=
set winbuild=1 set winbuild=1
set "nul=>nul 2>&1" set "nul=>nul 2>&1"
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set psc=powershell.exe -nop -c set psc=powershell.exe -nop -c
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
@ -2534,7 +2588,7 @@ exit /b
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
@ -2686,9 +2740,11 @@ if %sps%==SoftwareLicensingService call :dk_refresh
echo %keyecho% %~1 [Successful] echo %keyecho% %~1 [Successful]
) else ( ) else (
call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%"
if not defined error ( if not defined showfix (
if defined altapplist call :dk_color %Red% "Activation ID not found for this key." if defined altapplist call :dk_color %Red% "Activation ID not found for this key."
echo:
call :dk_color %Blue% "%_fixmsg%" call :dk_color %Blue% "%_fixmsg%"
echo:
set showfix=1 set showfix=1
) )
set error=1 set error=1
@ -2929,6 +2985,7 @@ if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%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% "Checking Probable Mal%w%ware Infection..."
if defined results (call :dk_color %Red% "%results%"&set showfix=1) if defined results (call :dk_color %Red% "%results%"&set showfix=1)
echo:
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@ -2949,40 +3006,118 @@ exit /b
set showfix= set showfix=
call :dk_chkmal call :dk_chkmal
::==============================
:: Check Sandboxing :: Check Sandboxing
sc query Null %nul% || ( sc query Null %nul% || (
set error=1 call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly]"
set showfix=1 if not defined showfix (
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]" echo:
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script." call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo: echo:
) )
set error=1
set showfix=1
)
::======================================================================================================================================== ::==============================
:: Check WinPE mode
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
call :dk_color %Red% "Checking WinPE [Found]"
if not defined showfix (
echo:
call :dk_color %Blue% "WinPE mode found. Reboot the system and run in normal mode."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check Safe mode
if defined safeboot_option (
call :dk_color %Red% "Checking Boot Mode [%safeboot_option%]"
if not defined showfix (
echo:
call :dk_color %Blue% "Safe mode found. Reboot the system and run in normal mode."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check ImageState
:: 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)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
if not defined showfix (
echo:
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
echo:
)
set error=1
set showfix=1
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
)
)
::==============================
:: Check corrupt services :: Check corrupt services
set serv_cor= set serv_cor=
for %%# in (%_serv%) do ( for %%# in (%_serv%) do (
set _regcorr=
set _corrupt= set _corrupt=
sc start %%# %nul% sc start %%# %nul%
if !errorlevel! EQU 1060 set _corrupt=1 if !errorlevel! EQU 1060 set _corrupt=1
sc query %%# %nul% || set _corrupt=1 sc query %%# %nul% || set _corrupt=1
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt ( for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _regcorr (
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || set _corrupt=1 reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1&set _regcorr=-RegistryError)
) )
if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (set "serv_cor=%%#")) if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#!_regcorr!") else (set "serv_cor=%%#!_regcorr!"))
) )
if defined serv_cor ( if defined serv_cor (
set error=1
set showfix=1
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]" call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
if not defined showfix (
echo:
if /i "%serv_cor%"=="sppsvc-RegistryError" (
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
) else (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
)
echo:
) )
::======================================================================================================================================== set error=1
set showfix=1
)
::==============================
:: Check disabled services :: Check disabled services
@ -3017,11 +3152,26 @@ if defined serv_cste (set "serv_cste=!serv_cste! %%#") else (set "serv_cste=%%#"
if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]" if defined serv_csts call :dk_color %Gray% "Enabling Disabled Services [Successful] [%serv_csts%]"
if defined serv_cste ( if defined serv_cste (
set error=1
call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]" call :dk_color %Red% "Enabling Disabled Services [Failed] [%serv_cste%]"
if not defined showfix (
echo:
echo %serv_cste% | findstr /i "ClipSVC sppsvc" %nul% && (
echo A registry fix has been applied to enable the disabled service.
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) || (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
)
echo:
) )
::======================================================================================================================================== set error=1
set showfix=1
)
::==============================
:: Check if the services are able to run or not :: Check if the services are able to run or not
:: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions :: Workarounds are added to get correct status and error code because sc query doesn't output correct results in some conditions
@ -3043,119 +3193,25 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
) )
if defined serv_e ( if defined serv_e (
set error=1
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]" call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." if not defined showfix (
set listwospp=%_serv:sppsvc=%
echo %serv_e% | findstr /i "!listwospp!" %nul% && (
set showfix=1 set showfix=1
) echo:
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
set fixes=%fixes% %mas%fix_service
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
set showfix=1
)
)
::========================================================================================================================================
:: Various error checks
if defined safeboot_option (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode found. Run in normal mode.]"
)
:: 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)
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set error=1
set showfix=1
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
set fixes=%fixes% %mas%in-place_repair_upgrade set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "If service error is still not fixed, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
) )
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
set error=1 set error=1
set showfix=1
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
) )
::==============================
set wpainfo= :: Check WMI
set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1
set wpaerror=1
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || (
echo Checking WPA Registry Count [%wpainfo%]
)
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
)
)
set osedition=0
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
if not %osedition%==0 (
if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
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%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
if %error_code% NEQ 0 (
set error=1
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
)
set wmifailed= set wmifailed=
if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1%
@ -3163,168 +3219,94 @@ if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Objec
if %errorlevel% NEQ 0 set wmifailed=1 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
if not defined showfix call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
set showfix=1
)
if not defined showfix (
if not defined notwinact ( echo:
if %winbuild% GEQ 10240 ( call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%" echo:
set /a "sum/=3"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
) )
) else (
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
set /a "sum/=2"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
)
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
::==============================
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( :: Check SPP Registry Key
set error=1
set showfix=1
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
)
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
echo Checking Eval WLMS Service [Found]
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
)
if defined _sppint (
echo %_sppint% | find /i "PerfOptions" %nul% && (
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
set showfix=1
) || (
echo Checking SPP In IFEO [%_sppint%]
)
)
if %winbuild% GEQ 7600 for /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 (
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
echo:
)
set error=1 set error=1
set showfix=1 set showfix=1
) )
::==============================
:: Check TokenStore registry key
set tokenstore= set tokenstore=
if %winbuild% GEQ 7600 ( if %winbuild% GEQ 7600 (
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b"
if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform"
if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" ( if %winbuild% GEQ 9200 if /i not "!tokenstore!"=="%SysPath%\spp\store" if /i not "!tokenstore!"=="%SysPath%\spp\store\2.0" if /i not "!tokenstore!"=="%SysPath%\spp\store_test\2.0" (
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set toerr=1 set toerr=1
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
) )
) )
::==============================
:: This code creates token folder only if it's missing and sets default permission for it :: This code creates token folder only if it's missing and sets default permission for it
if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" (
mkdir "%tokenstore%" %nul% mkdir "%tokenstore%" %nul%
if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';"
if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';"
set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;" set "d=!d! $AclObject = New-Object System.Security.AccessControl.DirectorySecurity;"
set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);" set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;" set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul% %psc% "!d!" %nul%
if exist "%tokenstore%\" ( if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]" call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else ( ) else (
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]" call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set error=1 set error=1
set showfix=1 set showfix=1
) )
) )
::==============================
if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found"
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps (
set error=1
set "_notfoundids=Not found"
)
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
)
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
set error=1
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
)
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -TaskPath '\Microsoft\Windows\SoftwareProtectionPlatform\').State" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
if not defined error call :dk_color %Blue% "Reboot your machine using the restart option."
)
)
)
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 if not defined toerr if not defined ps32onArm if exist "%tokenstore%\" (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -3352,29 +3334,299 @@ if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
if defined permerror ( if defined permerror (
set error=1
call :dk_color %Red% "Checking SPP Permissions [!permerror!]" call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
set showfix=1
)
)
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
if not defined serv_cor if not defined serv_cste if defined error if /i not %error_code%==0 if not defined showfix (
if not defined permerror if defined wpaerror (call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option." & set showfix=1)
if not defined showfix ( if not defined showfix (
set showfix=1 echo:
call :dk_color %Blue% "%_fixmsg%" call :dk_color %Blue% "%_fixmsg%"
if not defined permerror call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option." echo:
)
set error=1
set showfix=1
) )
) )
if not defined showfix if defined wpaerror ( ::==============================
:: Check WPA Registry Errors
set chkalp=
set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp (
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
if not defined showfix (
echo "%wpainfo%" | find /i "Error Found" %nul% && (
echo:
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
echo:
set error=1
set showfix=1 set showfix=1
call :dk_color %Blue% "If activation fails then go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
) )
)
set wpainfo=a
)
if not defined chkalp (
if %wpainfo% GEQ 5000 (
call :dk_color %Gray% "Checking WPA Registry Count [%wpainfo%]"
echo:
call :dk_color %Blue% "A large number of WPA registries have been found, which may cause high CPU usage."
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
echo:
) else (
echo Checking WPA Registry Count [%wpainfo%]
)
)
::==============================
:: Check Rearm
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
call :dk_color %Red% "Checking Rearm [System is Rearmed]"
if not defined showfix (
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
echo:
)
set error=1
set showfix=1
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
if not defined showfix (
echo:
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check SoftwareLicensingService
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%
set error_code=%errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
if %error_code% NEQ 0 (
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] [%error_code%]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check Activation IDs
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
)
if not defined apps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps if defined allapps if not defined notwinact (
call :dk_color %Gray% "Checking Activation IDs [Key Not Installed or Act ID Not Found]"
)
if not defined apps if not defined allapps (
call :dk_color %Red% "Checking Activation IDs [Not found]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
set error=1
set showfix=1
)
if not defined showfix if defined rlicfailed (
echo:
call :dk_color %Blue% "%_fixmsg%"
call :dk_color %Blue% "If activation still fails then run Fix WPA Registry option."
echo:
)
if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
)
::==============================
:: Check Eval Windows
if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
call :dk_color %Red% "Checking Eval Packages [License swapping found. Non-Eval licenses are installed in Eval Windows]"
if not defined showfix (
echo:
call :dk_color %Blue% "License swapping is not the right way to upgrade to the full version. Learn the correct method at the link below."
set fixes=%fixes% %mas%evaluation_editions
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
echo:
)
set error=1
set showfix=1
)
)
::==============================
:: Check HKU\S-1-5-20\Software registry, in some systems it's missing and that causes Windows activation problems
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
if not defined showfix (
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
echo:
)
set error=1
set showfix=1
)
::==============================
:: Check license and package files for the current edition
set osedition=0
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
if not %osedition%==0 (
if "%osSKU%"=="164" set osedition=ProfessionalEducation
if "%osSKU%"=="165" set osedition=ProfessionalEducationN
)
if not defined notwinact (
if %osedition%==0 (
call :dk_color %Red% "Checking Edition Name [Not Found In Registry]"
) else (
if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" (
set skunotfound=1
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
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%]"
)
)
)
)
::==============================
:: Check SKU value to find if there is any difference
if not defined notwinact (
if %winbuild% GEQ 10240 (
%nul% set /a "sum=%slcSKU%+%regSKU%+%wmiSKU%"
set /a "sum/=3"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI/REG SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU% Reg:%regSKU%]"
)
) else (
%nul% set /a "sum=%slcSKU%+%wmiSKU%"
set /a "sum/=2"
if not "!sum!"=="%slcSKU%" (
call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found - SLC:%slcSKU% WMI:%wmiSKU%]"
)
)
)
::==============================
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist "%SysPath%\wlms\wlms.exe" (
echo Checking Eval WLMS Service [Found]
)
::==============================
:: Check SPP interference in IFEO
for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
)
if defined _sppint (
echo %_sppint% | find /i "PerfOptions" %nul% && (
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
if not defined showfix (
echo:
call :dk_color %Blue% "%_fixmsg%"
echo:
)
set showfix=1
) || (
echo Checking SPP In IFEO [%_sppint%]
)
)
::==============================
:: Check and fix SkipRearm registry value
if %winbuild% GEQ 7600 for /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 (
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
call :dk_color %Gray% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
)
::==============================
:: Check SvcRestartTask status, this task helps in making sure system remains activated
if %winbuild% GEQ 9200 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
%psc% "Get-WmiObject -Query 'SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Select-Object -Property Description" %nul2% | findstr /i "KMS_" %nul1% || (
for /f "delims=" %%a in ('%psc% "$s=New-Object -ComObject 'Schedule.Service'; $s.Connect(); $state=$s.GetFolder('\Microsoft\Windows\SoftwareProtectionPlatform').GetTask('SvcRestartTask').State; @{0='Unknown';1='Disabled';2='Queued';3='Ready';4='Running'}[$state]" %nul6%') do (set taskinfo=%%a)
echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
if "!taskinfo!"=="" set "taskinfo=Not Found"
call :dk_color %Gray% "Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.]"
if not defined showfix (
echo:
echo "!taskinfo!" | findstr /i "Removed Not Found" %nul1% && (
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
) || (
call :dk_color %Blue% "Reboot your machine using the restart option and run the script again."
)
echo:
)
)
)
)
::==============================
exit /b exit /b

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -135,6 +136,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto dk_done
)
)
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%eline% %eline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -214,6 +225,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done goto dk_done
) )
@ -228,13 +242,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto dk_done goto dk_done
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -1521,7 +1548,7 @@ if ($appIdsList.Count -gt 0) {
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -42,6 +42,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -140,6 +141,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto dk_done
)
)
if %winbuild% LSS 7600 ( if %winbuild% LSS 7600 (
%eline% %eline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -219,6 +230,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done goto dk_done
) )
@ -233,13 +247,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto dk_done goto dk_done
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -844,7 +871,7 @@ exit /b
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -134,6 +135,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto done2 goto done2
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto done2
)
)
if %winbuild% LSS 6001 ( if %winbuild% LSS 6001 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -230,6 +241,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto done2 goto done2
) )
@ -244,13 +258,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto done2 goto done2
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto done2
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -769,7 +796,7 @@ exit /b
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)

View File

@ -1,11 +1,11 @@
@set masver=3.4 @set masver=3.7
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass<>grave<.>dev :: Homepage: mass()grave(dot)dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -135,6 +136,16 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
sc query gcs | find /i "RUNNING" %nul% && (
%eline%
echo Windows Sandbox detected.
echo The script cannot run due to missing licensing components. Aborting...
echo:
goto dk_done
)
)
if %winbuild% LSS 6001 ( if %winbuild% LSS 6001 (
%nceline% %nceline%
echo Unsupported OS version detected [%winbuild%]. echo Unsupported OS version detected [%winbuild%].
@ -231,6 +242,9 @@ REM check Powershell core version
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && ( cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting... echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done goto dk_done
) )
@ -245,13 +259,26 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_
goto dk_done goto dk_done
) )
REM check if .NET is working properly
if /i "!tstresult2!"=="FullLanguage" (
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
if !errorlevel!==3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo:
set fixes=%fixes% %mas%in-place_repair_upgrade
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script.
echo: echo:
sc query sense | find /i "RUNNING" %nul% && ( sc query sense | find /i "RUNNING" %nul% && (
echo Installed Antivirus - Microsoft Defender for Endpoint echo Installed Antivirus - Microsoft Defender for Endpoint
@ -1629,7 +1656,7 @@ exit /b
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c set psc=%ps% -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
set _slexe=sppsvc.exe& set _slser=sppsvc set _slexe=sppsvc.exe& set _slser=sppsvc
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)

View File

@ -6,25 +6,42 @@
<hr> <hr>
## How to Activate Windows / Office? ## How to Activate Windows / Office / Extended Updates (ESU)?
### Method 1 - PowerShell (Windows 8 and later) ❤️ ### Method 1 - PowerShell ❤️
1. **Open PowerShell** 1. **Open PowerShell**
To do that, press the Windows key + X, then select PowerShell or Terminal. Click the **Start Menu**, type `PowerShell`, then open it.
2. **Copy and paste the code below, then press enter.** 2. **Copy and paste the code below, then press enter.**
``` - For **Windows 8, 10, 11**: 📌
irm https://get.activated.win | iex ```
``` irm https://get.activated.win | iex
Alternatively, you can use the following (this will be deprecated in the future): ```
``` - For **Windows 7** and later:
irm https://massgrave.dev/get | iex ```
``` iex ((New-Object Net.WebClient).DownloadString('https://get.activated.win'))
```
3. You will see the activation options. Choose the activation options highlighted in green. <details>
4. That's all <summary>Script not launching❓Click here for info.</summary>
---
- If the above is blocked (by ISP/DNS), try this (needs **updated Windows 10 or 11**):
```
iex (curl.exe -s --doh-url https://1.1.1.1/dns-query https://get.activated.win | Out-String)
```
- If that fails or you have an older Windows, use the below-listed Method 2.
---
</details>
3. The activation menu will appear. **Choose the green-highlighted options** to activate Windows or Office.
4. **Done!**
--- ---
@ -47,16 +64,14 @@ or
--- ---
- To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation). > [!TIP]
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches). > - Some ISPs/DNS block access to our domains. You can bypass this by enabling [DNS-over-HTTPS (DoH)](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/encrypted-dns-browsers/) in your browser.
> - **Having trouble**❓Visit our [troubleshooting page](https://massgrave.dev/troubleshoot) or raise an issue on [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts/issues).
--- ---
### Not working ❓ - To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
--- ---
@ -69,8 +84,8 @@ or
--- ---
``` ```
Latest Version: 3.4 Latest Version: 3.7
Release date: 3-June-2025 Release date: 11-Sep-2025
``` ```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot) ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)