mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-10-31 15:13:23 +08:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			de812acdc5
			...
			b5ba36c033
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b5ba36c033 | ||
|   | d10b6d691e | 
| @ -842,17 +842,18 @@ goto :dl_final | ||||
| 
 | ||||
| set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL" | ||||
| 
 | ||||
| if defined _int ( | ||||
| if %keyerror% EQU 0 if defined _int ( | ||||
| reg delete "%_ident%" /f %nul% | ||||
| reg query "%_ident%" %nul% && ( | ||||
| echo: | ||||
| set error=1 | ||||
| call :dk_color %Red% "Deleting IdentityCRL Registry           [Failed] [%_ident%]" | ||||
| ) | ||||
| for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null") | ||||
| call :dk_refresh | ||||
| call :dk_act | ||||
| call :dk_checkperm | ||||
| 
 | ||||
| reg query "%_ident%" %nul% || ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Generating New IdentityCRL Registry     [Failed] [%_ident%]" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| ::========================================================================================================================================== | ||||
| @ -860,7 +861,6 @@ call :dk_checkperm | ||||
| ::  Extended licensing servers tests incase error not found and activation failed | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| set resfail= | ||||
| ipconfig /flushdns %nul% | ||||
| set "tls=[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;" | ||||
| 
 | ||||
| @ -873,30 +873,35 @@ set "d1=!d1! $client = [System.Net.Http.HttpClient]::new();" | ||||
| set "d1=!d1! $response = $client.GetAsync('https://%%#').GetAwaiter().GetResult();" | ||||
| set "d1=!d1! $response.Content.ReadAsStringAsync().GetAwaiter().GetResult()" | ||||
| %psc% "!tls! !d1!" %nul2% | findstr /i "PurchaseFD DeviceAddResponse" %nul1% || set resfail=1 | ||||
| if defined resfail %psc% "!tls! !d1!" | ||||
| ) | ||||
| 
 | ||||
| if not defined resfail ( | ||||
| %psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | find /i "traceId" %nul1% || set resfail=1 | ||||
| if defined resfail %psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| if defined resfail ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Checking Licensing Servers              [Failed to Connect]" | ||||
| for %%# in ( | ||||
| login.live.com | ||||
| purchase.mp.microsoft.com | ||||
| licensing.mp.microsoft.com | ||||
| ) do ( | ||||
| findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [Blocked in Hosts]" | ||||
| ) | ||||
| call :dk_color %Red% "Checking Licensing Servers              [Failed to Connect]!hosfail!" | ||||
| set fixes=%fixes% %mas%licensing-servers-issue | ||||
| call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| ::========================================================================================================================================== | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| ::  Windows update and store block check | ||||
| 
 | ||||
| reg query "%_ident%" %nul% || ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Generating New IdentityCRL Registry     [Failed] [%_ident%]" | ||||
| ) | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| 
 | ||||
| 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 | ||||
| @ -921,6 +926,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || (set wuco | ||||
| ) | ||||
| 
 | ||||
| if defined wucorrupt ( | ||||
| set error=1 | ||||
| call :dk_color %Red% "Checking Windows Update Registry        [Corruption Found]" | ||||
| if !wcount! GTR 2 ( | ||||
| call :dk_color %Red% "Windows seems to be infected with Mal%w%ware." | ||||
| @ -932,16 +938,21 @@ call :dk_color %Blue% "HWID activation needs working Windows updates, if you hav | ||||
| ) else ( | ||||
| %psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null" | ||||
| sc query wuauserv | find /i "RUNNING" %nul% || ( | ||||
| set error=1 | ||||
| set wuerror=1 | ||||
| sc start wuauserv %nul% | ||||
| call :dk_color %Red% "Starting Windows Update Service         [Failed] [!errorlevel!]" | ||||
| call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it." | ||||
| ) | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| REM Check Internet related error codes | ||||
| ::========================================================================================================================================== | ||||
| 
 | ||||
| if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock ( | ||||
| ::  Check Internet related error codes | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock if not defined resfail ( | ||||
| echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && ( | ||||
| call :dk_color %Red% "Checking Internet Issues                [Found] %error_code%" | ||||
| set fixes=%fixes% %mas%licensing-servers-issue | ||||
| @ -6602,23 +6613,6 @@ $Admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti | ||||
| $line2 = "============================================================" | ||||
| $line3 = "____________________________________________________________" | ||||
| 
 | ||||
| function UnQuickEdit | ||||
| { | ||||
| 	$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 1).DefineDynamicModule((Get-Random), $False).DefineType((Get-Random)) | ||||
| 	$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128) | ||||
| 	$k=$t.CreateType() | ||||
| 	if ($winbuild -GE 17763) { | ||||
| 		if ($k::SendMessageW($k::GetConsoleWindow(), 127, 0, 0) -EQ [IntPtr]::Zero) { | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
| 	$v=(0x0080, 0x00A0)[!($winbuild -GE 10586)] | ||||
| 	$b=$k::SetConsoleMode($k::GetStdHandle(-10), $v) | ||||
| } | ||||
| 
 | ||||
| function echoWindows | ||||
| { | ||||
| 	CONOUT "$line2" | ||||
| @ -7527,7 +7521,6 @@ function ClicRun | ||||
| #endregion | ||||
| 
 | ||||
| $Host.UI.RawUI.WindowTitle = "Check Activation Status" | ||||
| UnQuickEdit | ||||
| if ($All.IsPresent) { | ||||
| 	$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B; | ||||
| 	if (!$Pass.IsPresent) {clear;} | ||||
|  | ||||
| @ -605,17 +605,18 @@ goto :dl_final | ||||
| 
 | ||||
| set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL" | ||||
| 
 | ||||
| if defined _int ( | ||||
| if %keyerror% EQU 0 if defined _int ( | ||||
| reg delete "%_ident%" /f %nul% | ||||
| reg query "%_ident%" %nul% && ( | ||||
| echo: | ||||
| set error=1 | ||||
| call :dk_color %Red% "Deleting IdentityCRL Registry           [Failed] [%_ident%]" | ||||
| ) | ||||
| for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null") | ||||
| call :dk_refresh | ||||
| call :dk_act | ||||
| call :dk_checkperm | ||||
| 
 | ||||
| reg query "%_ident%" %nul% || ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Generating New IdentityCRL Registry     [Failed] [%_ident%]" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| ::========================================================================================================================================== | ||||
| @ -623,7 +624,6 @@ call :dk_checkperm | ||||
| ::  Extended licensing servers tests incase error not found and activation failed | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| set resfail= | ||||
| ipconfig /flushdns %nul% | ||||
| set "tls=[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;" | ||||
| 
 | ||||
| @ -643,25 +643,28 @@ if not defined resfail ( | ||||
| %psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | find /i "traceId" %nul1% || set resfail=1 | ||||
| if defined resfail %psc% "!tls! irm https://licensing.mp.microsoft.com/v7.0/licenses/content -Method POST" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| if defined resfail ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Checking Licensing Servers              [Failed to Connect]" | ||||
| for %%# in ( | ||||
| login.live.com | ||||
| purchase.mp.microsoft.com | ||||
| licensing.mp.microsoft.com | ||||
| ) do ( | ||||
| findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [Blocked in Hosts]" | ||||
| ) | ||||
| call :dk_color %Red% "Checking Licensing Servers              [Failed to Connect]!hosfail!" | ||||
| set fixes=%fixes% %mas%licensing-servers-issue | ||||
| call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| ::========================================================================================================================================== | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| ::  Windows update and store block check | ||||
| 
 | ||||
| reg query "%_ident%" %nul% || ( | ||||
| set error=1 | ||||
| echo: | ||||
| call :dk_color %Red% "Generating New IdentityCRL Registry     [Failed] [%_ident%]" | ||||
| ) | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| 
 | ||||
| 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 | ||||
| @ -686,6 +689,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || (set wuco | ||||
| ) | ||||
| 
 | ||||
| if defined wucorrupt ( | ||||
| set error=1 | ||||
| call :dk_color %Red% "Checking Windows Update Registry        [Corruption Found]" | ||||
| if !wcount! GTR 2 ( | ||||
| call :dk_color %Red% "Windows seems to be infected with Mal%w%ware." | ||||
| @ -697,16 +701,21 @@ call :dk_color %Blue% "HWID activation needs working Windows updates, if you hav | ||||
| ) else ( | ||||
| %psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null" | ||||
| sc query wuauserv | find /i "RUNNING" %nul% || ( | ||||
| set error=1 | ||||
| set wuerror=1 | ||||
| sc start wuauserv %nul% | ||||
| call :dk_color %Red% "Starting Windows Update Service         [Failed] [!errorlevel!]" | ||||
| call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it." | ||||
| ) | ||||
| ) | ||||
| ) | ||||
| 
 | ||||
| REM Check Internet related error codes | ||||
| ::========================================================================================================================================== | ||||
| 
 | ||||
| if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock ( | ||||
| ::  Check Internet related error codes | ||||
| 
 | ||||
| if %keyerror% EQU 0 if not defined _perm if defined _int ( | ||||
| if not defined wucorrupt if not defined wublock if not defined wuerror if not defined storeblock if not defined resfail ( | ||||
| echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && ( | ||||
| call :dk_color %Red% "Checking Internet Issues                [Found] %error_code%" | ||||
| set fixes=%fixes% %mas%licensing-servers-issue | ||||
|  | ||||
| @ -140,23 +140,6 @@ $Admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti | ||||
| $line2 = "============================================================" | ||||
| $line3 = "____________________________________________________________" | ||||
| 
 | ||||
| function UnQuickEdit | ||||
| { | ||||
| 	$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 1).DefineDynamicModule((Get-Random), $False).DefineType((Get-Random)) | ||||
| 	$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128) | ||||
| 	$t.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128) | ||||
| 	$k=$t.CreateType() | ||||
| 	if ($winbuild -GE 17763) { | ||||
| 		if ($k::SendMessageW($k::GetConsoleWindow(), 127, 0, 0) -EQ [IntPtr]::Zero) { | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
| 	$v=(0x0080, 0x00A0)[!($winbuild -GE 10586)] | ||||
| 	$b=$k::SetConsoleMode($k::GetStdHandle(-10), $v) | ||||
| } | ||||
| 
 | ||||
| function echoWindows | ||||
| { | ||||
| 	CONOUT "$line2" | ||||
| @ -1065,7 +1048,6 @@ function ClicRun | ||||
| #endregion | ||||
| 
 | ||||
| $Host.UI.RawUI.WindowTitle = "Check Activation Status" | ||||
| UnQuickEdit | ||||
| if ($All.IsPresent) { | ||||
| 	$B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B; | ||||
| 	if (!$Pass.IsPresent) {clear;} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user