mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-11-04 17:13:24 +08:00 
			
		
		
		
	Update Online_KMS_Activation.cmd
This commit is contained in:
		
							parent
							
								
									242badaa1c
								
							
						
					
					
						commit
						2674528a55
					
				@ -52,7 +52,7 @@ set "_debug=0"
 | 
			
		||||
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
::  Set Environment variables, it helps if they are misconfigured in the system
 | 
			
		||||
::  Set environment variables, it helps if they are misconfigured in the system
 | 
			
		||||
 | 
			
		||||
setlocal EnableExtensions
 | 
			
		||||
setlocal DisableDelayedExpansion
 | 
			
		||||
@ -129,7 +129,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
 | 
			
		||||
@ -144,7 +144,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
 | 
			
		||||
@ -197,7 +197,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::========================================================================================================================================
 | 
			
		||||
 | 
			
		||||
::  Fix special characters limitation in path name
 | 
			
		||||
::  Fix special character limitations in path name
 | 
			
		||||
 | 
			
		||||
set "_work=%~dp0"
 | 
			
		||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
			
		||||
@ -258,7 +258,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
 | 
			
		||||
)
 | 
			
		||||
@ -551,7 +551,7 @@ call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if not defined key if defined notfoundaltactID (
 | 
			
		||||
call :dk_color %Red% "Checking Alternate Edition for %KS%      [%altedition% Activation ID Not Found]"
 | 
			
		||||
call :dk_color %Red% "Checking Alternate Edition For %KS%      [%altedition% Activation ID Not Found]"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if not defined key if not defined _gvlk (
 | 
			
		||||
@ -579,7 +579,7 @@ echo:
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined winsub (
 | 
			
		||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. The script will activate the base edition [SKU ID-%regSKU%]."
 | 
			
		||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]."
 | 
			
		||||
echo:
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -1291,7 +1291,7 @@ reg delete "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwarePr
 | 
			
		||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\0ff1ce15-a989-479d-af46-f275c6370663" /f %nul%
 | 
			
		||||
reg delete "HKU\S-1-5-20\Software\Microsoft\OfficeSoftwareProtectionPlatform\Policies\59a52881-a989-479d-af46-f275c6370663" /f %nul%
 | 
			
		||||
 | 
			
		||||
echo Clearing Office License Blocks          [Successfully Cleared From All %counter% Useraccounts]
 | 
			
		||||
echo Clearing Office License Blocks          [Successfully cleared from all %counter% user accounts]
 | 
			
		||||
 | 
			
		||||
::==========================
 | 
			
		||||
 | 
			
		||||
@ -1309,7 +1309,7 @@ for %%# in (%_sidlist%) do (
 | 
			
		||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
 | 
			
		||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
 | 
			
		||||
)
 | 
			
		||||
echo Adding Reg Keys To Skip License Check   [Successfully Added To All %counter% ^& Future New Useraccounts]
 | 
			
		||||
echo Adding Reg Keys to Skip License Check   [Successfully added to all %counter% ^& future new user accounts]
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
::==========================
 | 
			
		||||
@ -1323,14 +1323,14 @@ reg query HKU\%%# %nul% && set failedtounload=1
 | 
			
		||||
 | 
			
		||||
if defined failedtoload (
 | 
			
		||||
set error=1
 | 
			
		||||
call :dk_color %Red% "Loading Unloaded accounts Registry      [Failed For Some Useraccounts]"
 | 
			
		||||
call :dk_color %Blue% "Restart the system and try again."
 | 
			
		||||
call :dk_color %Red% "Loading Unloaded Accounts Registry      [Failed for some user accounts]"
 | 
			
		||||
call :dk_color %Blue% "Restart your system and try again."
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined failedtounload (
 | 
			
		||||
set error=1
 | 
			
		||||
call :dk_color %Red% "Unloading loaded accounts Registry      [Failed For Some Useraccounts]"
 | 
			
		||||
call :dk_color %Blue% "Restart the system and try again."
 | 
			
		||||
call :dk_color %Red% "Unloading Loaded Account Registries     [Failed for some user accounts]"
 | 
			
		||||
call :dk_color %Blue% "Restart your system and try again."
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
exit /b
 | 
			
		||||
@ -2573,7 +2573,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=[AV URLs are blocked in hosts]"
 | 
			
		||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
 | 
			
		||||
 | 
			
		||||
set wucount=0
 | 
			
		||||
for %%# in (wuauserv) do (
 | 
			
		||||
@ -2582,7 +2582,7 @@ for %%G in (DependOnService Description DisplayName ErrorControl ImagePath Objec
 | 
			
		||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
 | 
			
		||||
)
 | 
			
		||||
)
 | 
			
		||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
 | 
			
		||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
 | 
			
		||||
 | 
			
		||||
sc start sppsvc %nul%
 | 
			
		||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
 | 
			
		||||
@ -2593,7 +2593,8 @@ 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 PUP Activators                 [Found%pupfound%]"
 | 
			
		||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection     %results%"
 | 
			
		||||
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:
 | 
			
		||||
@ -2612,7 +2613,7 @@ call :dk_chkmal
 | 
			
		||||
sc query Null %nul% || (
 | 
			
		||||
set error=1
 | 
			
		||||
set showfix=1
 | 
			
		||||
call :dk_color %Red% "Checking 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:
 | 
			
		||||
)
 | 
			
		||||
@ -2703,7 +2704,7 @@ if defined serv_e (
 | 
			
		||||
set error=1
 | 
			
		||||
call :dk_color %Red% "Starting Services                       [Failed] [%serv_e%]"
 | 
			
		||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
 | 
			
		||||
call :dk_color %Blue% "Restart the system to fix this error."
 | 
			
		||||
call :dk_color %Blue% "Restart your system to fix this error."
 | 
			
		||||
set showfix=1
 | 
			
		||||
)
 | 
			
		||||
)
 | 
			
		||||
@ -2743,7 +2744,7 @@ 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 WPA Registry Error             [%wpainfo%]"
 | 
			
		||||
call :dk_color %Red% "Checking WPA Registry Errors            [%wpainfo%]"
 | 
			
		||||
) || (
 | 
			
		||||
echo Checking WPA Registry Count             [%wpainfo%]
 | 
			
		||||
)
 | 
			
		||||
@ -2782,7 +2783,7 @@ call :dk_color %Red% "Checking License Files                  [Not Found] [%osed
 | 
			
		||||
 | 
			
		||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
 | 
			
		||||
set error=1
 | 
			
		||||
call :dk_color %Red% "Checking Package File                   [Not Found] [%osedition%]"
 | 
			
		||||
call :dk_color %Red% "Checking Package Files                  [Not Found] [%osedition%]"
 | 
			
		||||
)
 | 
			
		||||
)
 | 
			
		||||
)
 | 
			
		||||
@ -2853,7 +2854,7 @@ 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 Reg               [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"
 | 
			
		||||
)
 | 
			
		||||
@ -2878,7 +2879,7 @@ 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 SPP Registry Key               [Incorrect ModuleId Found]"
 | 
			
		||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
 | 
			
		||||
call :dk_color2 %Blue% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %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
 | 
			
		||||
set showfix=1
 | 
			
		||||
)
 | 
			
		||||
@ -2908,9 +2909,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 SPP Token Folder               [Not Found. Created Now] [%tokenstore%\]"
 | 
			
		||||
call :dk_color %Gray% "Checking SPP Token Folder               [Not Found, Created Now] [%tokenstore%\]"
 | 
			
		||||
) 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%\]"
 | 
			
		||||
set error=1
 | 
			
		||||
set showfix=1
 | 
			
		||||
)
 | 
			
		||||
@ -3028,7 +3029,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
 | 
			
		||||
    }
 | 
			
		||||
    for ($i=1; $i -le $count; $i++) {
 | 
			
		||||
        if (-not $subkeyHashTable.ContainsKey("$i")) {
 | 
			
		||||
            Write-Output "Total Keys $count. Error Found- $i key does not exist"
 | 
			
		||||
            Write-Output "Total Keys $count. Error Found - $i key does not exist."
 | 
			
		||||
			$wpaKey.Close()
 | 
			
		||||
			exit
 | 
			
		||||
        }
 | 
			
		||||
@ -3039,7 +3040,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
 | 
			
		||||
        if ($PSVersionTable.PSVersion.Major -lt 3) {
 | 
			
		||||
            cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
 | 
			
		||||
			if ($LASTEXITCODE -ne 0) {
 | 
			
		||||
            Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
 | 
			
		||||
            Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
 | 
			
		||||
			$wpaKey.Close()
 | 
			
		||||
			exit
 | 
			
		||||
			}
 | 
			
		||||
@ -3047,7 +3048,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
 | 
			
		||||
            $subkey = $wpaKey.OpenSubKey($_)
 | 
			
		||||
            $p = $subkey.GetValueNames()
 | 
			
		||||
            if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
 | 
			
		||||
                Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
 | 
			
		||||
                Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
 | 
			
		||||
				$wpaKey.Close()
 | 
			
		||||
				exit
 | 
			
		||||
            }
 | 
			
		||||
@ -3086,13 +3087,13 @@ echo:
 | 
			
		||||
if %_unattended%==1 timeout /t 2 & exit /b
 | 
			
		||||
 | 
			
		||||
if defined fixes (
 | 
			
		||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
 | 
			
		||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
 | 
			
		||||
choice /C:10 /N
 | 
			
		||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined terminal (
 | 
			
		||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
 | 
			
		||||
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
 | 
			
		||||
choice /c 0 /n
 | 
			
		||||
) else (
 | 
			
		||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user