mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-01-20 22:20:44 +01:00
Compare commits
46 commits
07ad5a208d
...
bbdc9bdfd8
Author | SHA1 | Date | |
---|---|---|---|
|
bbdc9bdfd8 | ||
|
7d036f57fd | ||
|
ab90514b0a | ||
|
25abc1f457 | ||
|
873c4bc4d8 | ||
|
0b402d9afe | ||
|
5141866f0a | ||
|
f0618824a4 | ||
|
03cc88193d | ||
|
897a9db808 | ||
|
9bbd02cc91 | ||
|
d1dca45710 | ||
|
5e71252993 | ||
|
1db017f1f1 | ||
|
d06ba7fc4c | ||
|
99954a9056 | ||
|
fcb710a48a | ||
|
0cbaa141c3 | ||
|
9d1964ceda | ||
|
0477cf13e1 | ||
|
9b568d4b4e | ||
|
1c9fe0815e | ||
|
a5dd99ac00 | ||
|
1849dd3075 | ||
|
8fe0b24945 | ||
|
7c69c471c5 | ||
|
f32cb934dc | ||
|
7a6e63a462 | ||
|
d76b2ea57e | ||
|
1f0e04519a | ||
|
d059952ecd | ||
|
6efb5d50fe | ||
|
b2831795a4 | ||
|
4e8ebecd3d | ||
|
d929cd8fa0 | ||
|
d384c5f2f7 | ||
|
643d4f077f | ||
|
db26b75b64 | ||
|
b80a502086 | ||
|
db218720f3 | ||
|
b8504cc21e | ||
|
2e6bfa94c2 | ||
|
a1244dcb3b | ||
|
06695612a8 | ||
|
323c6808af | ||
|
841d856a29 |
10 changed files with 1251 additions and 565 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -143,6 +145,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/HWID" set _act=1
|
||||
|
@ -215,7 +219,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -263,6 +268,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -537,14 +543,14 @@ echo Generating GenuineTicket.xml [Successful]
|
|||
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_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 %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -606,7 +612,7 @@ 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 10 | Out-Null")
|
||||
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
|
||||
|
@ -675,7 +681,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucor
|
|||
if defined wucorrupt (
|
||||
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
||||
) else (
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null"
|
||||
sc query wuauserv | find /i "RUNNING" %nul% || (
|
||||
set wuerror=1
|
||||
sc start wuauserv %nul%
|
||||
|
@ -749,12 +755,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -764,6 +773,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -940,7 +950,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Get Activation IDs from licensing files if not found through WMI
|
||||
|
@ -1009,7 +1019,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1063,26 +1073,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
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 URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1098,6 +1098,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -1189,7 +1196,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -1219,14 +1226,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
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%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -1260,7 +1274,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -1303,7 +1321,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
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
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %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]"
|
||||
|
@ -1345,17 +1363,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
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"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -1376,7 +1397,7 @@ echo Checking SPP 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]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -1425,7 +1446,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -1450,6 +1471,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -1458,7 +1480,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: 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 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -1592,7 +1614,11 @@ 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_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -47,26 +47,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -146,6 +148,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/KMS38" set _act=1
|
||||
|
@ -218,7 +222,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -266,6 +271,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -516,18 +522,29 @@ call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Acti
|
|||
)
|
||||
|
||||
if not defined key if not defined _gvlk (
|
||||
%eline%
|
||||
echo:
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support KMS38 activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files were not found in %SysPath%\spp\tokens\skus\
|
||||
|
||||
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||
|
||||
if defined skunotfound (
|
||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if defined sppks (
|
||||
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if not defined skunotfound if not defined sppks (
|
||||
call :dk_color %Red% "This product does not support KMS38 activation."
|
||||
call :dk_color %Blue% "Make sure you are using the latest version of the script."
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
)
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
|
@ -651,7 +668,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||
|
||||
:: Stop sppsvc
|
||||
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
|
||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
||||
echo Stopping sppsvc Service [Successful]
|
||||
|
@ -660,14 +677,14 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|||
)
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_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 %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -860,12 +877,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -875,6 +895,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1067,7 +1088,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
||||
|
@ -1118,7 +1139,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1217,26 +1238,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
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 URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1252,6 +1263,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -1343,7 +1361,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -1373,14 +1391,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
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%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -1414,7 +1439,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -1457,7 +1486,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
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
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %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]"
|
||||
|
@ -1499,17 +1528,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
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"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -1530,7 +1562,7 @@ echo Checking SPP 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]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -1579,7 +1611,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -1604,6 +1636,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -1612,7 +1645,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: 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 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -1746,7 +1779,11 @@ 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_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -143,6 +145,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/Ohook" set _act=1
|
||||
|
@ -208,7 +212,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -256,6 +261,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -350,7 +356,7 @@ cls
|
|||
if not defined terminal (
|
||||
mode 130, 32
|
||||
if exist "%SysPath%\spp\store_test\" mode 134, 32
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
title Ohook Activation %masver%
|
||||
|
||||
|
@ -410,11 +416,14 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v P
|
|||
%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
|
||||
%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
|
||||
if %winbuild% GEQ 10240 (
|
||||
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" set o16uwp=Office UWP )
|
||||
)
|
||||
|
||||
if not "%o14msi%%o14c2r%%o16uwp%"=="" (
|
||||
echo:
|
||||
call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]"
|
||||
if not "%o14msi%%o16uwp%"=="" call :dk_color %Blue% "Use Online KMS option to activate it."
|
||||
)
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
|
||||
|
@ -704,7 +713,12 @@ reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
|||
reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
|
||||
reg unload HKU\DEF_TEMP %nul%
|
||||
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty $('{0}\{1}' -f $p, $_.PSChildName)).ProfileImagePath; if ($pi -like $('{0}\Users\*' -f $Env:SystemDrive)) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
set _sidlist=
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
|
||||
if not defined _sidlist (
|
||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||
)
|
||||
|
||||
for %%# in (!_sidlist!) do (
|
||||
|
||||
|
@ -839,14 +853,15 @@ exit /b
|
|||
|
||||
if not defined _oLPath exit /b
|
||||
|
||||
if defined _oIntegrator (
|
||||
if %oVer%==16 (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
|
||||
) else (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
|
||||
)
|
||||
|
||||
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
|
||||
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
|
||||
)
|
||||
|
||||
:: Fallback to manual method to install licenses incase integrator.exe is not working
|
||||
|
||||
|
@ -1106,19 +1121,10 @@ set _sortIds=!_sortIds:PreInstallR_=Retail_!
|
|||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||
|
||||
set _sidlist=
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like """"$Env:SystemDrive\Users\*"""" -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
|
||||
if not defined _sidlist (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1126,16 +1132,18 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|||
:: Load the unloaded useraccounts registry
|
||||
|
||||
set loadedsids=
|
||||
set failedtoload=
|
||||
set failedtounload=
|
||||
set alrloadedsids=
|
||||
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg query HKU\%%#\Software %nul% || (
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||
) || (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "loadedsids=%%loadedsids%% %%#"
|
||||
) || (
|
||||
set failedtoload=1
|
||||
reg unload HKU\%%# %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1143,6 +1151,23 @@ set failedtoload=1
|
|||
|
||||
::==========================
|
||||
|
||||
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% EQU 0 (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||
|
||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||
|
@ -1163,6 +1188,23 @@ reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f %
|
|||
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f /reg:32 %nul%
|
||||
)
|
||||
|
||||
:: Clear vNext in UWP Office
|
||||
|
||||
if defined o16uwpapplist (
|
||||
for %%# in (%_sidlist%) do (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\LocalCache\Local\Microsoft\Office\Licenses\" %nul%
|
||||
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
|
||||
set defname=DEFTEMP-%%#
|
||||
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Identity /f %nul%
|
||||
reg unload HKU\!defname! %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
:: Clear SharedComputerLicensing for office
|
||||
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
|
||||
|
||||
|
@ -1197,18 +1239,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
|||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||
:: Resiliency registry entry can skip this check
|
||||
|
||||
set defname=DEFTEMP-%random%
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||
|
||||
if defined o16c2r if defined officeact (
|
||||
reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
||||
reg query HKU\DEF_TEMP %nul% || set failedtoload=1
|
||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
reg unload HKU\DEF_TEMP %nul%
|
||||
reg query HKU\DEF_TEMP %nul% && set failedtounload=1
|
||||
if exist "%defdat%\NTUSER.DAT" (
|
||||
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||
reg query HKU\%defname%\Software %nul% && (
|
||||
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
reg unload HKU\%defname% %nul%
|
||||
)
|
||||
|
||||
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 user accounts]
|
||||
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1217,19 +1264,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
|||
|
||||
for %%# in (%loadedsids%) do (
|
||||
reg unload HKU\%%# %nul%
|
||||
reg query HKU\%%# %nul% && set failedtounload=1
|
||||
)
|
||||
|
||||
if defined failedtoload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
if defined failedtounload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
@ -1326,12 +1360,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -1341,6 +1378,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1417,6 +1455,22 @@ set allapps=
|
|||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
|
||||
|
||||
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
|
||||
|
||||
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
||||
set len=0
|
||||
echo:!allapps!> %SystemRoot%\Temp\chklen
|
||||
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
|
||||
del %SystemRoot%\Temp\chklen %nul%
|
||||
|
||||
if !len! GTR 6000 (
|
||||
%eline%
|
||||
echo Too many licenses are installed, the script may crash.
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
timeout /t 30
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
:: Get installed products Activation IDs
|
||||
|
@ -1477,7 +1531,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1515,26 +1569,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
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 URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1550,6 +1594,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|