mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-04-18 10:26:10 +08:00
Compare commits
No commits in common. "b5ba36c033f160a7e8814d6f96d33ebfc5105e67" and "de812acdc5cfa814ba55dd4b6fb0780cb83f1906" have entirely different histories.
b5ba36c033
...
de812acdc5
@ -842,18 +842,17 @@ goto :dl_final
|
||||
|
||||
set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL"
|
||||
|
||||
if %keyerror% EQU 0 if defined _int (
|
||||
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%]"
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
@ -861,6 +860,7 @@ call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%
|
||||
:: 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,36 +873,31 @@ 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:
|
||||
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!"
|
||||
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"
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
|
||||
:: Windows update and store block check
|
||||
|
||||
if %keyerror% EQU 0 if not defined _perm if defined _int (
|
||||
|
||||
reg query "%_ident%" %nul% || (
|
||||
set error=1
|
||||
echo:
|
||||
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 (
|
||||
@ -926,7 +921,6 @@ 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."
|
||||
@ -938,21 +932,16 @@ 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
|
||||
|
||||
:: 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 (
|
||||
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 Internet Issues [Found] %error_code%"
|
||||
set fixes=%fixes% %mas%licensing-servers-issue
|
||||
@ -6613,6 +6602,23 @@ $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"
|
||||
@ -7521,6 +7527,7 @@ 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,18 +605,17 @@ goto :dl_final
|
||||
|
||||
set "_ident=HKU\S-1-5-19\SOFTWARE\Microsoft\IdentityCRL"
|
||||
|
||||
if %keyerror% EQU 0 if defined _int (
|
||||
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%]"
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
@ -624,6 +623,7 @@ call :dk_color %Red% "Generating New IdentityCRL Registry [Failed] [%_ident%
|
||||
:: 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,29 +643,26 @@ 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:
|
||||
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!"
|
||||
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"
|
||||
)
|
||||
)
|
||||
|
||||
::==========================================================================================================================================
|
||||
|
||||
:: Windows update and store block check
|
||||
|
||||
if %keyerror% EQU 0 if not defined _perm if defined _int (
|
||||
|
||||
reg query "%_ident%" %nul% || (
|
||||
set error=1
|
||||
echo:
|
||||
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 (
|
||||
@ -689,7 +686,6 @@ 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."
|
||||
@ -701,21 +697,16 @@ 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
|
||||
|
||||
:: 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 (
|
||||
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 Internet Issues [Found] %error_code%"
|
||||
set fixes=%fixes% %mas%licensing-servers-issue
|
||||
|
@ -140,6 +140,23 @@ $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"
|
||||
@ -1048,6 +1065,7 @@ 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