mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2024-11-23 02:35:36 +08:00
Update KMS38_Activation.cmd
This commit is contained in:
parent
7733f6ccda
commit
97251fa6a6
@ -30,7 +30,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
|
||||
@ -107,7 +107,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
|
||||
@ -122,7 +122,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
|
||||
@ -178,7 +178,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%"
|
||||
@ -239,7 +239,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
|
||||
)
|
||||
@ -556,7 +556,7 @@ if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (App
|
||||
if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL').Get()).ID | %% {echo ('ID='+$_)}" %nul6%') do call set "app=%%a"
|
||||
|
||||
if not defined app (
|
||||
call :dk_color %Red% "Checking for Installed GVLK Activation ID [Not Found] Aborting..."
|
||||
call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..."
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto :dk_done
|
||||
@ -629,7 +629,7 @@ set "sessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAV
|
||||
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
||||
|
||||
if not exist "%tdir%\GenuineTicket.xml" (
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]"
|
||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
|
||||
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
||||
goto :k_final
|
||||
) else (
|
||||
@ -656,7 +656,7 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
||||
%_xmlexist% (
|
||||
set error=1
|
||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]"
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -680,7 +680,7 @@ call :dk_color %Red% "Installing GenuineTicket.xml [Failed With clipu
|
||||
if exist "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*.xml" (
|
||||
set error=1
|
||||
set rebuildinfo=1
|
||||
call :dk_color %Red% "Checking for Ticket Migration [Failed]"
|
||||
call :dk_color %Red% "Checking Ticket Migration [Failed]"
|
||||
)
|
||||
|
||||
if not defined showfix if defined rebuildinfo (
|
||||
@ -798,9 +798,9 @@ title Remove KMS38 Protection %masver%
|
||||
|
||||
echo:
|
||||
%nul% reg query "HKLM\%specific_kms%" && (
|
||||
call :dk_color %Red% "Removing the Specific KMS Host [Failed]"
|
||||
call :dk_color %Red% "Removing Specific KMS Host [Failed]"
|
||||
) || (
|
||||
echo Removing the Specific KMS Host [Successful]
|
||||
echo Removing Specific KMS Host [Successful]
|
||||
)
|
||||
|
||||
goto :dk_done
|
||||
@ -1215,7 +1215,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 (
|
||||
@ -1224,7 +1224,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% && (
|
||||
@ -1234,8 +1234,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 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:
|
||||
@ -1254,7 +1255,7 @@ call :dk_chkmal
|
||||
sc query Null %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking for Sandboxing [Found, the 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:
|
||||
)
|
||||
@ -1279,7 +1280,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%]"
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1345,7 +1346,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
|
||||
)
|
||||
)
|
||||
@ -1367,7 +1368,7 @@ set error=1
|
||||
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 it in normal mode in case 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."
|
||||
)
|
||||
)
|
||||
|
||||
@ -1375,7 +1376,7 @@ call :dk_color %Blue% "You need to run it in normal mode in case you are running
|
||||
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 found. Run in normal mode.]"
|
||||
call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE mode found. Run in normal mode.]"
|
||||
)
|
||||
|
||||
|
||||
@ -1385,7 +1386,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 for WPA Registry Errors [%wpainfo%]"
|
||||
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||
) || (
|
||||
echo Checking WPA Registry Count [%wpainfo%]
|
||||
)
|
||||
@ -1394,7 +1395,7 @@ 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"
|
||||
)
|
||||
@ -1413,18 +1414,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%]"
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -1473,7 +1474,7 @@ 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]"
|
||||
)
|
||||
|
||||
|
||||
@ -1488,14 +1489,14 @@ call :dk_color2 %Red% "Checking ClipSVC " %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"
|
||||
)
|
||||
@ -1505,13 +1506,13 @@ 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 SkipRearm [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
|
||||
)
|
||||
@ -1520,7 +1521,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
|
||||
)
|
||||
@ -1550,9 +1551,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
|
||||
)
|
||||
@ -1577,7 +1578,7 @@ 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%\]"
|
||||
)
|
||||
|
||||
|
||||
@ -1670,7 +1671,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
|
||||
}
|
||||
@ -1681,7 +1682,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
|
||||
}
|
||||
@ -1689,7 +1690,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
|
||||
}
|
||||
@ -1728,13 +1729,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…
Reference in New Issue
Block a user