Update HWID_Activation.cmd

This commit is contained in:
WindowsAddict 2024-08-20 22:40:17 +05:30 committed by GitHub
parent 416b4f2142
commit 7733f6ccda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,7 +104,7 @@ set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
sc query Null | find /i "RUNNING"
if %errorlevel% NEQ 0 (
echo:
echo The Null service, which is required for the script to operate, is not running.
echo Null service is not running, script may crash...
echo:
echo:
echo Help - %mas%troubleshoot
@ -119,7 +119,7 @@ cls
pushd "%~dp0"
>nul findstr /v "$" "%~nx0" && (
echo:
echo Error - The script either has an LF line ending issue or an empty line at the end of the script is missing.
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo:
echo:
echo Help - %mas%troubleshoot
@ -236,7 +236,7 @@ goto dk_done
%nul1% fltmc || (
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
%eline%
echo This script needs administrator rights.
echo This script needs admin rights.
echo Right click on this script and select 'Run as administrator'.
goto dk_done
)
@ -450,7 +450,7 @@ if not defined key call :hwidfallback
if defined altkey (set key=%altkey%&set changekey=1&set notworking=)
if defined notworking if defined notfoundaltactID (
call :dk_color %Red% "Checking for Alternate Edition to Use for HWID [%altedition% Activation ID Not Found]"
call :dk_color %Red% "Checking Alternate Edition For HWID [%altedition% Activation ID Not Found]"
)
if not defined key (
@ -484,7 +484,7 @@ echo:
)
if defined winsub (
call :dk_color %Blue% "Windows Subscription edition [SKU ID-%slcSKU%] detected. The script will activate the base edition [SKU ID-%regSKU%]."
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script will activate base edition [SKU ID-%regSKU%]."
echo:
)
@ -502,9 +502,9 @@ if not "%name%"=="US" (
set regionchange=1
%psc% "Set-WinHomeLocation -GeoId 244" %nul%
if !errorlevel! EQU 0 (
echo Changing the Windows Region to USA [Successful]
echo Changing Windows Region To USA [Successful]
) else (
call :dk_color %Red% "Changing the Windows Region to USA [Failed]"
call :dk_color %Red% "Changing Windows Region To USA [Failed]"
)
)
@ -639,7 +639,7 @@ if not defined resfail (
if defined resfail (
set error=1
echo:
call :dk_color %Red% "Connecting to Licensing Servers [Failed to Connect]"
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
set fixes=%fixes% %mas%licensing-servers-issue
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
)
@ -657,11 +657,11 @@ call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess %nul2% | find /i "0x1" %nul% && set wublock=1
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DoNotConnectToWindowsUpdateInternetLocations %nul2% | find /i "0x1" %nul% && set wublock=1
if defined wublock call :dk_color %Red% "Checking for Windows Update Blocker in Registry [Found]"
if defined wublock call :dk_color %Red% "Checking Update Blocker In Registry [Found]"
reg query "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps %nul2% | find /i "0x1" %nul% && (
set storeblock=1
call :dk_color %Red% "Checking for Microsoft Store Blocker in Registry [Found]"
call :dk_color %Red% "Checking Store Blocker In Registry [Found]"
)
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type ServiceSidType RequiredPrivileges FailureActions) do if not defined wucorrupt (
@ -687,7 +687,7 @@ REM Check Internet related error codes
if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock (
echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && (
call :dk_color %Red% "Checking for Internet Issues [Found] %error_code%"
call :dk_color %Red% "Checking Internet Issues [Found] %error_code%"
set fixes=%fixes% %mas%licensing-servers-issue
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
)
@ -720,9 +720,9 @@ echo:
if defined regionchange (
%psc% "Set-WinHomeLocation -GeoId %nation%" %nul%
if !errorlevel! EQU 0 (
echo Restoring the Windows Region [Successful]
echo Restoring Windows Region [Successful]
) else (
call :dk_color %Red% "Restoring the Windows Region [Failed] [%name% - %nation%]"
call :dk_color %Red% "Restoring Windows Region [Failed] [%name% - %nation%]"
)
)
@ -931,7 +931,7 @@ exit /b
:dk_reeval
:: This key is left by the system during the rearm process and sppsvc sometimes fails to delete it, it causes severe issues with SPP's scheduled tasks leading to random deactivations.
:: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP
set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState"
reg delete "%ruleskey%" /v "State" /f %nul%
@ -1072,7 +1072,7 @@ set pupfound=%pupfound1%%pupfound2%
set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URL's are blocked in hosts]"
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
set wucount=0
for %%# in (wuauserv) do (
@ -1091,8 +1091,9 @@ if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%
)
if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking for PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking for Probable Mal%w%ware Infection %results%"
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
if defined results call :dk_color %Red% "%results%"
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo:
@ -1111,7 +1112,7 @@ call :dk_chkmal
sc query Null %nul% || (
set error=1
set showfix=1
call :dk_color %Red% "Checking for Sandboxing [Found, script may not work properly.]"
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
echo:
)
@ -1136,7 +1137,7 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
if defined serv_cor (
set error=1
set showfix=1
call :dk_color %Red% "Checking for Corrupt Services [%serv_cor%]"
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
)
::========================================================================================================================================
@ -1200,7 +1201,7 @@ if defined checkerror if defined serv_e (set "serv_e=!serv_e!, %%#-!errorcode!")
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% "Restart your system to fix this error."
set showfix=1
@ -1214,17 +1215,17 @@ set showfix=1
if defined safeboot_option (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode detected. Run the script in normal mode.]"
call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option%] " %Blue% "[Safe mode found. Run in normal mode.]"
)
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" (
set error=1
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && (
set showfix=1
call :dk_color %Blue% "You need to run the script in normal mode if you are running the script in Audit Mode."
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
)
)
@ -1232,7 +1233,7 @@ call :dk_color %Blue% "You need to run the script in normal mode if you are runn
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot %nul% && (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking for WinPE mode " %Blue% "[WinPE mode detected. Run the script in normal mode.]"
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
)
@ -1242,16 +1243,16 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1
set wpaerror=1
call :dk_color %Red% "Checking for WPA Registry Errors [%wpainfo%]"
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
) || (
echo Checking WPA Registry Count [%wpainfo%]
echo Checking WPA Registry Count [%wpainfo%]
)
if not defined officeact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
set error=1
call :dk_color %Red% "Checking for Evaluation Packages [Non-Evaluation Licenses are installed in Evaluation Windows]"
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% "Help - " %_Yellow% " %mas%evaluation_editions"
)
@ -1270,18 +1271,18 @@ if "%osSKU%"=="165" set osedition=ProfessionalEducationN
if not defined officeact (
if %osedition%==0 (
call :dk_color %Red% "Checking for Edition Name [Not Found In Registry]"
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" (
set error=1
set skunotfound=1
call :dk_color %Red% "Checking for License Files [Not Found] [%osedition%]"
call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]"
)
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
set error=1
call :dk_color %Red% "Checking for Package Files [Not Found] [%osedition%]"
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
)
)
)
@ -1293,7 +1294,7 @@ 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%"
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] %error_code%"
)
@ -1305,7 +1306,7 @@ if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
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
)
@ -1330,14 +1331,14 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking for Rearm " %Blue% "[System Restart is Required]"
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]"
)
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1
set showfix=1
call :dk_color2 %Red% "Checking for ClipSVC Volatile Key " %Blue% "[System Restart is Required]"
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]"
)
@ -1345,14 +1346,14 @@ call :dk_color2 %Red% "Checking for ClipSVC Volatile Key " %Blue% "[System
if exist "%SysPath%\wlms\wlms.exe" (
sc query wlms | find /i "RUNNING" %nul% && (
echo Checking for Evaluation WLMS Service [Found]
echo Checking Eval WLMS Service [Found]
)
)
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
)
@ -1362,20 +1363,20 @@ for %%# in (SppEx%w%tComObj.exe sppsvc.exe) 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 Checking for SPP Interference In IFEO [%_sppint%]
echo Checking SPP Interference In IFEO [%_sppint%]
)
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 for SkipRearm Registry Key [Default 0 Value Not Found. Changing to 0]"
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
set error=1
)
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 for SPP Registry Key [Incorrect ModuleId Found]"
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1
@ -1390,7 +1391,7 @@ if %winbuild% GEQ 9200 if /i not "%tokenstore%"=="%SysPath%\spp\store" if /i not
set toerr=1
set error=1
set showfix=1
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
)
@ -1407,9 +1408,9 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
%psc% "!d!" %nul%
if exist "%tokenstore%\" (
call :dk_color %Gray% "Checking for SPP Token Folder [Not Found, Creating Now] [%tokenstore%\]"
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
) else (
call :dk_color %Red% "Checking for SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
set error=1
set showfix=1
)
@ -1427,14 +1428,14 @@ if not defined allapps (
set "_notfoundids=Not found"
)
set error=1
call :dk_color %Red% "Checking for Activation IDs [!_notfoundids!]"
call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]"
)
)
if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" (
set error=1
call :dk_color %Red% "Checking for SPP tokens.dat [Not Found] [%tokenstore%\]"
call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]"
)
@ -1448,7 +1449,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
)
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by HWID 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=
if %winbuild% GEQ 9200 (
@ -1591,7 +1592,7 @@ if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
call :dk_color %_Yellow% "Press [0] to %_exitmsg%..."
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."