Compare commits

..

No commits in common. "bbdc9bdfd8cb9d9a7cacb5a1d0e543c34f4e9bde" and "07ad5a208dbe0f4cb570c22a11b27d864c7905c6" have entirely different histories.

10 changed files with 567 additions and 1253 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -44,28 +44,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -145,8 +143,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="/HWID" set _act=1 if /i "%%A"=="/HWID" set _act=1
@ -219,8 +215,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -268,7 +263,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -543,14 +537,14 @@ echo Generating GenuineTicket.xml [Successful]
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml"" set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
%_xmlexist% ( %_xmlexist% (
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
%_xmlexist% timeout /t 2 %nul% %_xmlexist% timeout /t 2 %nul%
%_xmlexist% timeout /t 2 %nul% %_xmlexist% timeout /t 2 %nul%
%_xmlexist% ( %_xmlexist% (
set error=1 set error=1
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul% if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]" call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
) )
) )
@ -612,7 +606,7 @@ echo:
set error=1 set error=1
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]" 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") for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
call :dk_refresh call :dk_refresh
call :dk_act call :dk_act
call :dk_checkperm call :dk_checkperm
@ -681,7 +675,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucor
if defined wucorrupt ( if defined wucorrupt (
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]" call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
) else ( ) else (
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
sc query wuauserv | find /i "RUNNING" %nul% || ( sc query wuauserv | find /i "RUNNING" %nul% || (
set wuerror=1 set wuerror=1
sc start wuauserv %nul% sc start wuauserv %nul%
@ -755,15 +749,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -773,7 +764,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -950,7 +940,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); 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 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) set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
exit /b exit /b
:: Get Activation IDs from licensing files if not found through WMI :: Get Activation IDs from licensing files if not found through WMI
@ -1019,7 +1009,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1073,16 +1063,26 @@ exit /b
set w= set w=
set results= set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if not defined pupfound ( 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 pupfound= KM%w%Spico 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%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" 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% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%[Likely File Infector]"
@ -1098,13 +1098,6 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: 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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1196,7 +1189,7 @@ set errorcode=
set checkerror= set checkerror=
sc query %%# | find /i "RUNNING" %nul% || ( sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
set errorcode=!errorlevel! set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1 sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
) )
@ -1226,21 +1219,14 @@ 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) 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" ( if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1 set error=1
set showfix=1 call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && ( 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 it in Audit Mode." 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"
)
) )
@ -1274,11 +1260,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0 set osedition=0
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%')" 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 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 :: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1321,7 +1303,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 %_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 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1 set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
@ -1363,20 +1345,17 @@ 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. :: 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" ( if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 ( sc query wlms | find /i "RUNNING" %nul% && (
echo Checking Eval WLMS Service [Found] 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% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
set showfix=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%in-place_repair_upgrade set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1397,7 +1376,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 ( 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% 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 20 | Out-Null" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
set error=1 set error=1
) )
@ -1446,7 +1425,7 @@ set showfix=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%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% %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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"
@ -1471,7 +1450,6 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
echo !taskinfo! | find /i "Ready" %nul% || ( echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %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 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]" call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
) )
) )
@ -1480,7 +1458,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. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1614,11 +1592,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -47,28 +47,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -148,8 +146,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="/KMS38" set _act=1 if /i "%%A"=="/KMS38" set _act=1
@ -222,8 +218,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -271,7 +266,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -522,28 +516,17 @@ call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Acti
) )
if not defined key if not defined _gvlk ( if not defined key if not defined _gvlk (
echo: %eline%
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound (
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 echo This product does not support KMS38 activation.
echo Make sure you are using the latest version of the script.
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% set fixes=%fixes% %mas%
echo %mas% echo %mas%
) else (
echo Required license files were not found in %SysPath%\spp\tokens\skus\
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
echo: echo:
goto dk_done goto dk_done
@ -668,7 +651,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
:: Stop sppsvc :: Stop sppsvc
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
sc query sppsvc | find /i "STOPPED" %nul% && ( sc query sppsvc | find /i "STOPPED" %nul% && (
echo Stopping sppsvc Service [Successful] echo Stopping sppsvc Service [Successful]
@ -677,14 +660,14 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
) )
%_xmlexist% ( %_xmlexist% (
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
%_xmlexist% timeout /t 2 %nul% %_xmlexist% timeout /t 2 %nul%
%_xmlexist% timeout /t 2 %nul% %_xmlexist% timeout /t 2 %nul%
%_xmlexist% ( %_xmlexist% (
set error=1 set error=1
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul% if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]" call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
) )
) )
@ -877,15 +860,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -895,7 +875,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -1088,7 +1067,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); 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 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) set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
exit /b exit /b
:: Install License files using Powershell/WMI instead of slmgr.vbs :: Install License files using Powershell/WMI instead of slmgr.vbs
@ -1139,7 +1118,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1238,16 +1217,26 @@ exit /b
set w= set w=
set results= set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if not defined pupfound ( 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 pupfound= KM%w%Spico 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%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" 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% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%[Likely File Infector]"
@ -1263,13 +1252,6 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: 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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1361,7 +1343,7 @@ set errorcode=
set checkerror= set checkerror=
sc query %%# | find /i "RUNNING" %nul% || ( sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
set errorcode=!errorlevel! set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1 sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
) )
@ -1391,21 +1373,14 @@ 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) 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" ( if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1 set error=1
set showfix=1 call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && ( 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 it in Audit Mode." 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"
)
) )
@ -1439,11 +1414,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0 set osedition=0
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%')" 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 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 :: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1486,7 +1457,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 %_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 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1 set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
@ -1528,20 +1499,17 @@ 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. :: 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" ( if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 ( sc query wlms | find /i "RUNNING" %nul% && (
echo Checking Eval WLMS Service [Found] 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% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
set showfix=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%in-place_repair_upgrade set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1562,7 +1530,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 ( 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% 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 20 | Out-Null" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
set error=1 set error=1
) )
@ -1611,7 +1579,7 @@ set showfix=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%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% %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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"
@ -1636,7 +1604,6 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
echo !taskinfo! | find /i "Ready" %nul% || ( echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %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 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]" call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
) )
) )
@ -1645,7 +1612,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. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1779,11 +1746,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -44,28 +44,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -145,8 +143,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="/Ohook" set _act=1 if /i "%%A"=="/Ohook" set _act=1
@ -212,8 +208,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -261,7 +256,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -356,7 +350,7 @@ cls
if not defined terminal ( if not defined terminal (
mode 130, 32 mode 130, 32
if exist "%SysPath%\spp\store_test\" mode 134, 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;}" %nul% %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;}"
) )
title Ohook Activation %masver% title Ohook Activation %masver%
@ -416,14 +410,11 @@ 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 %_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 %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
if %winbuild% GEQ 10240 ( if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
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%"=="" ( if not "%o14msi%%o14c2r%%o16uwp%"=="" (
echo: echo:
call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]" 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% && ( if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
@ -713,12 +704,7 @@ 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 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% reg unload HKU\DEF_TEMP %nul%
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 $('{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))
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 ( for %%# in (!_sidlist!) do (
@ -853,15 +839,14 @@ exit /b
if not defined _oLPath exit /b if not defined _oLPath exit /b
if defined _oIntegrator (
if %oVer%==16 ( if %oVer%==16 (
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul% "!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
) else ( ) else (
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul% "!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
) )
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
)
:: Fallback to manual method to install licenses incase integrator.exe is not working :: Fallback to manual method to install licenses incase integrator.exe is not working
@ -1121,10 +1106,19 @@ set _sortIds=!_sortIds:PreInstallR_=Retail_!
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state :: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
set _sidlist= 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)) 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))
if not defined _sidlist ( 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) 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%]"
) )
::========================== ::==========================
@ -1132,18 +1126,16 @@ for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Wh
:: Load the unloaded useraccounts registry :: Load the unloaded useraccounts registry
set loadedsids= set loadedsids=
set alrloadedsids= set failedtoload=
set failedtounload=
for %%# in (%_sidlist%) do ( 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 ( 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 load HKU\%%# "%%b\NTUSER.DAT" %nul%
reg query HKU\%%#\Software %nul% && ( reg query HKU\%%#\Software %nul% && (
call set "loadedsids=%%loadedsids%% %%#" call set "loadedsids=%%loadedsids%% %%#"
) || ( ) || (
reg unload HKU\%%# %nul% set failedtoload=1
) )
) )
) )
@ -1151,23 +1143,6 @@ reg unload HKU\%%# %nul%
::========================== ::==========================
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 :: Clear the vNext/shared/device license blocks which may prevent ohook activation
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul% rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
@ -1188,23 +1163,6 @@ 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% 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 :: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation :: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1239,23 +1197,18 @@ 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." :: 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 :: 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 ( if defined o16c2r if defined officeact (
if exist "%defdat%\NTUSER.DAT" ( reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul% reg query HKU\DEF_TEMP %nul% || set failedtoload=1
reg query HKU\%defname%\Software %nul% && ( 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 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\DEF_TEMP %nul%
) reg query HKU\DEF_TEMP %nul% && set failedtounload=1
reg unload HKU\%defname% %nul%
)
for %%# in (%_sidlist%) do ( for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul% 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% 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 Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts] echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
) )
::========================== ::==========================
@ -1264,6 +1217,19 @@ echo Adding Registry to Skip License Check [Successfully added to all %counter
for %%# in (%loadedsids%) do ( for %%# in (%loadedsids%) do (
reg unload HKU\%%# %nul% 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 exit /b
@ -1360,15 +1326,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -1378,7 +1341,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -1455,22 +1417,6 @@ 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 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%')" 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")) %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 exit /b
:: Get installed products Activation IDs :: Get installed products Activation IDs
@ -1531,7 +1477,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -1569,16 +1515,26 @@ exit /b
set w= set w=
set results= set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if not defined pupfound ( 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 pupfound= KM%w%Spico 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%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" 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% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%[Likely File Infector]"
@ -1594,13 +1550,6 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: 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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1692,7 +1641,7 @@ set errorcode=
set checkerror= set checkerror=
sc query %%# | find /i "RUNNING" %nul% || ( sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
set errorcode=!errorlevel! set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1 sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
) )
@ -1722,21 +1671,14 @@ 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) 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" ( if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1 set error=1
set showfix=1 call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && ( 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 it in Audit Mode." 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"
)
) )
@ -1770,11 +1712,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0 set osedition=0
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%')" 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 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 :: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -1817,7 +1755,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 %_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 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1 set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
@ -1859,20 +1797,17 @@ 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. :: 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" ( if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 ( sc query wlms | find /i "RUNNING" %nul% && (
echo Checking Eval WLMS Service [Found] 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% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
set showfix=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%in-place_repair_upgrade set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -1893,7 +1828,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 ( 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% 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 20 | Out-Null" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
set error=1 set error=1
) )
@ -1942,7 +1877,7 @@ set showfix=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%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% %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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"
@ -1967,7 +1902,6 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
echo !taskinfo! | find /i "Ready" %nul% || ( echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %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 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]" call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
) )
) )
@ -1976,7 +1910,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. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -2110,11 +2044,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -2189,15 +2119,15 @@ for %%# in (
15_191509f2-6977-456f-ab30-cf0492b1e93a_NB77V-RPFQ6-PMMKQ-T87DV-M4%f%D84_Retail________WordRetail 15_191509f2-6977-456f-ab30-cf0492b1e93a_NB77V-RPFQ6-PMMKQ-T87DV-M4%f%D84_Retail________WordRetail
15_9cedef15-be37-4ff0-a08a-13a045540641_RPHPB-Y7NC4-3VYFM-DW7VD-G8%f%YJ8_MAK___________WordVolume 15_9cedef15-be37-4ff0-a08a-13a045540641_RPHPB-Y7NC4-3VYFM-DW7VD-G8%f%YJ8_MAK___________WordVolume
:: Office 365 - 15.0 version :: Office 365 - 15.0 version
15_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail 15_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
15_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail 15_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail
15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail 15_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail 15_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
:: Office 365 - 16.0 version :: Office 365 - 16.0 version
16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail 16_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W62NQ-267QR-RTF74-PF2MH-JQ%f%MTH_Subscription__O365EduCloudRetail 16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_W62NQ-267QR-RTF74-PF2MH-JQ%f%MTH_Subscription__O365EduCloudRetail
16_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail 16_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail
16_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail 16_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail 16_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
:: Office 2016 :: Office 2016
16_bfa358b0-98f1-4125-842e-585fa13032e6_WHK4N-YQGHB-XWXCC-G3HYC-6J%f%F94_Retail________AccessRetail 16_bfa358b0-98f1-4125-842e-585fa13032e6_WHK4N-YQGHB-XWXCC-G3HYC-6J%f%F94_Retail________AccessRetail

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -69,28 +69,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -171,8 +169,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_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 defined _args for %%A in (%_args%) do (
if /i "%%A"=="-el" (set _elev=1) if /i "%%A"=="-el" (set _elev=1)
if /i "%%A"=="/K-Windows" (set _actwin=1) if /i "%%A"=="/K-Windows" (set _actwin=1)
@ -241,8 +237,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -290,7 +285,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -416,7 +410,7 @@ cls
if not defined terminal ( if not defined terminal (
mode 115, 32 mode 115, 32
if exist "%SysPath%\spp\store_test\" mode 135, 32 if exist "%SysPath%\spp\store_test\" mode 135, 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;}" %nul% %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;}"
) )
title Online %KS% Activation %masver% title Online %KS% Activation %masver%
@ -562,29 +556,14 @@ call :dk_color %Red% "Checking Alternate Edition For %KS% [%altedition% Act
if not defined key if not defined _gvlk ( if not defined key if not defined _gvlk (
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
if not defined skunotfound (
if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 echo This product does not support %KS% activation.
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1
if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.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% "%KS% activation is supported but failed to find the %KS% 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 %KS% activation."
if %winbuild% LSS 9200 (
call :dk_color2 %Blue% "Use the alternative activator listed here - " %_Yellow% " %mas%unsupported_products_activation"
)
set fixes=%fixes% %mas%unsupported_products_activation set fixes=%fixes% %mas%unsupported_products_activation
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%unsupported_products_activation"
) else (
echo Required license files not found in %SysPath%\spp\tokens\skus\
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
echo: echo:
goto :ks_office goto :ks_office
@ -648,14 +627,18 @@ call :dk_color %Gray% "Checking Ohook [Ohook activation
:: Check unsupported office versions :: Check unsupported office versions
set o14c2r= set o14c2r=
set o16uwp=
set _68=HKLM\SOFTWARE\Microsoft\Office set _68=HKLM\SOFTWARE\Microsoft\Office
set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R %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 %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
if not "%o14c2r%"=="" ( if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
if not "%o14c2r%%o16uwp%"=="" (
echo: echo:
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%]" call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]"
) )
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && ( if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
@ -668,13 +651,6 @@ set ohub=1
call :ks_getpath call :ks_getpath
set o16uwp=
set o16uwp_path=
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=1&set "o16uwp_path=%%a"))
)
sc query ClickToRunSvc %nul% sc query ClickToRunSvc %nul%
set error1=%errorlevel% set error1=%errorlevel%
@ -695,10 +671,10 @@ set o15c2r=
set error=1 set error=1
) )
if "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" ( if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
set error=1 set error=1
echo: echo:
if not "%o14c2r%"=="" ( if not "%o14c2r%%o16uwp%"=="" (
call :dk_color %Red% "Checking Supported Office Install [Not Found]" call :dk_color %Red% "Checking Supported Office Install [Not Found]"
) else ( ) else (
call :dk_color %Red% "Checking Installed Office [Not Found]" call :dk_color %Red% "Checking Installed Office [Not Found]"
@ -715,8 +691,8 @@ goto :ks_activate
) )
set multioffice= set multioffice=
if not "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1 if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
if not "%o14c2r%"=="" set multioffice=1 if not "%o14c2r%%o16uwp%"=="" set multioffice=1
if defined multioffice ( if defined multioffice (
echo: echo:
@ -725,46 +701,6 @@ call :dk_color %Gray% "Checking Multiple Office Install [Found. Recommend
::======================================================================================================================================== ::========================================================================================================================================
:: Process Office UWP
if not defined o16uwp goto :ks_starto15c2r
call :ks_reset
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
set oVer=16
set "_oLPath=%o16uwp_path%\Licenses16"
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty Dependencies) | Select-Object PackageFullName" %nul6%') do (set "o16uwpapplist=!o16uwpapplist! %%a")
echo "%o16uwpapplist%" | findstr /i "Access Excel OneNote Outlook PowerPoint Publisher SkypeForBusiness Word" %nul% && set "_oIds=O365HomePremRetail"
for %%# in (Project Visio) do (
echo "%o16uwpapplist%" | findstr /i "%%#" %nul% && (
set _lat=
if exist "%_oLPath%\%%#Pro2024VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2024Retail " & set _lat=1
if not defined _lat if exist "%_oLPath%\%%#Pro2021VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2021Retail " & set _lat=1
if not defined _lat if exist "%_oLPath%\%%#Pro2019VL*.xrm-ms" set "_oIds= !_oIds! %%#Pro2019Retail " & set _lat=1
if not defined _lat set "_oIds= !_oIds! %%#ProRetail "
)
)
set uwpinfo=%o16uwp_path:C:\Program Files\WindowsApps\Microsoft.Office.Desktop_=%
echo:
echo Processing Office... [UWP ^| %uwpinfo%]
if not defined _oIds (
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
set error=1
goto :ks_starto15c2r
)
call :ks_process
::========================================================================================================================================
:ks_starto15c2r
:: Process Office 15.0 C2R :: Process Office 15.0 C2R
if not defined o15c2r goto :ks_starto16c2r if not defined o15c2r goto :ks_starto16c2r
@ -855,7 +791,7 @@ if defined o16msi call :ks_processmsi 16 %o16msi_reg%
echo: echo:
call :oh_clearblock call :oh_clearblock
if "%o16msi%%o15msi%"=="" if not "%o16uwp%%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey if "%o16msi%%o15msi%"=="" if not "%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey
call :oh_licrefresh call :oh_licrefresh
::======================================================================================================================================== ::========================================================================================================================================
@ -1054,8 +990,6 @@ exit /b
:ks_osppready :ks_osppready
if not defined _config exit /b
echo: %_config% | find /i "propertyBag" %nul1% && ( echo: %_config% | find /i "propertyBag" %nul1% && (
set "_osppt=REG_DWORD" set "_osppt=REG_DWORD"
set "_osppready=%o15c2r_reg%" set "_osppready=%o15c2r_reg%"
@ -1222,15 +1156,14 @@ exit /b
if not defined _oLPath exit /b if not defined _oLPath exit /b
if defined _oIntegrator (
if %oVer%==16 ( if %oVer%==16 (
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul% "!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
) else ( ) else (
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul% "!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
) )
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
)
:: Fallback to manual method to install licenses incase integrator.exe is not working :: Fallback to manual method to install licenses incase integrator.exe is not working
@ -1274,10 +1207,19 @@ exit /b
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state :: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
set _sidlist= 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)) 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))
if not defined _sidlist ( 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) 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%]"
) )
::========================== ::==========================
@ -1285,18 +1227,16 @@ for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Wh
:: Load the unloaded useraccounts registry :: Load the unloaded useraccounts registry
set loadedsids= set loadedsids=
set alrloadedsids= set failedtoload=
set failedtounload=
for %%# in (%_sidlist%) do ( 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 ( 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 load HKU\%%# "%%b\NTUSER.DAT" %nul%
reg query HKU\%%#\Software %nul% && ( reg query HKU\%%#\Software %nul% && (
call set "loadedsids=%%loadedsids%% %%#" call set "loadedsids=%%loadedsids%% %%#"
) || ( ) || (
reg unload HKU\%%# %nul% set failedtoload=1
) )
) )
) )
@ -1304,23 +1244,6 @@ reg unload HKU\%%# %nul%
::========================== ::==========================
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 :: Clear the vNext/shared/device license blocks which may prevent ohook activation
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul% rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
@ -1341,23 +1264,6 @@ 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% 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 :: Clear SharedComputerLicensing for office
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation :: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
@ -1392,23 +1298,18 @@ 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." :: 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 :: 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 ( if defined o16c2r if defined officeact (
if exist "%defdat%\NTUSER.DAT" ( reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul% reg query HKU\DEF_TEMP %nul% || set failedtoload=1
reg query HKU\%defname%\Software %nul% && ( 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 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\DEF_TEMP %nul%
) reg query HKU\DEF_TEMP %nul% && set failedtounload=1
reg unload HKU\%defname% %nul%
)
for %%# in (%_sidlist%) do ( for %%# in (%_sidlist%) do (
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul% 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% 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 Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts] echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
) )
::========================== ::==========================
@ -1417,6 +1318,19 @@ echo Adding Registry to Skip License Check [Successfully added to all %counter
for %%# in (%loadedsids%) do ( for %%# in (%loadedsids%) do (
reg unload HKU\%%# %nul% 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 exit /b
@ -2312,15 +2226,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -2330,7 +2241,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -2479,22 +2389,6 @@ 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 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%')" 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")) %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 exit /b
:: Get installed products Activation IDs :: Get installed products Activation IDs
@ -2520,7 +2414,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); 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 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) set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
exit /b exit /b
:: Install License files using Powershell/WMI instead of slmgr.vbs :: Install License files using Powershell/WMI instead of slmgr.vbs
@ -2571,7 +2465,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
@ -2670,16 +2564,26 @@ exit /b
set w= set w=
set results= set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
if not defined pupfound ( 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 pupfound= KM%w%Spico 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%
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" 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% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%[Likely File Infector]"
@ -2695,13 +2599,6 @@ set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: 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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -2793,7 +2690,7 @@ set errorcode=
set checkerror= set checkerror=
sc query %%# | find /i "RUNNING" %nul% || ( sc query %%# | find /i "RUNNING" %nul% || (
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null" %psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
set errorcode=!errorlevel! set errorcode=!errorlevel!
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1 sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
) )
@ -2823,21 +2720,14 @@ 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) 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" ( if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
set error=1 set error=1
set showfix=1 call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
echo "%imagestate%" | find /i "RESEAL" %nul% && ( 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 it in Audit Mode." 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"
)
) )
@ -2871,11 +2761,7 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
set osedition=0 set osedition=0
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%')" 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 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 :: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
@ -2918,7 +2804,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 %_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 if %errorlevel% NEQ 0 set wmifailed=1
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed ( if defined wmifailed (
set error=1 set error=1
call :dk_color %Red% "Checking WMI [Not Working]" call :dk_color %Red% "Checking WMI [Not Working]"
@ -2960,20 +2846,17 @@ 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. :: 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" ( if exist "%SysPath%\wlms\wlms.exe" (
if %winbuild% LSS 9200 ( sc query wlms | find /i "RUNNING" %nul% && (
echo Checking Eval WLMS Service [Found] 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% || ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
set error=1 set error=1
set showfix=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%in-place_repair_upgrade set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) )
@ -2994,7 +2877,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 ( 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% 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 20 | Out-Null" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
set error=1 set error=1
) )
@ -3043,7 +2926,7 @@ set showfix=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%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% %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%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"
@ -3068,7 +2951,6 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
echo !taskinfo! | find /i "Ready" %nul% || ( echo !taskinfo! | find /i "Ready" %nul% || (
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %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 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]" call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
) )
) )
@ -3077,7 +2959,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. :: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
set permerror= set permerror=
if %winbuild% GEQ 9200 if not defined ps32onArm ( if %winbuild% GEQ 9200 (
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -3211,11 +3093,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -3483,6 +3361,7 @@ ae2ee509-1b34-41c0-acb7-6d4650168915_33PXH-7Y6KF-2VJC9-XBBR8-HV%f%THH___4_Enterp
b92e9980-b9d5-4821-9c94-140f632f6312_FJ82H-XT6CR-J8D7P-XQJJ2-GP%f%DD4__48_Professional b92e9980-b9d5-4821-9c94-140f632f6312_FJ82H-XT6CR-J8D7P-XQJJ2-GP%f%DD4__48_Professional
54a09a0d-d57b-4c10-8b69-a842d6590ad5_MRPKT-YTG23-K7D7T-X2JMM-QY%f%7MG__49_ProfessionalN 54a09a0d-d57b-4c10-8b69-a842d6590ad5_MRPKT-YTG23-K7D7T-X2JMM-QY%f%7MG__49_ProfessionalN
db537896-376f-48ae-a492-53d0547773d0_YBYF6-BHCR3-JPKRB-CDW7B-F9%f%BK4__65_Embedded_POSReady db537896-376f-48ae-a492-53d0547773d0_YBYF6-BHCR3-JPKRB-CDW7B-F9%f%BK4__65_Embedded_POSReady
e1a8296a-db37-44d1-8cce-7bc961d59c54_XGY72-BRBBT-FF8MH-2GG8H-W7%f%KCW__65_Embedded_Standard
aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395_73KQT-CD9G6-K7TQG-66MRP-CQ%f%22C__65_Embedded_ThinPC aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395_73KQT-CD9G6-K7TQG-66MRP-CQ%f%22C__65_Embedded_ThinPC
5a041529-fef8-4d07-b06f-b59b573b32d2_W82YF-2Q76Y-63HXB-FGJG9-GF%f%7QX__69_ProfessionalE 5a041529-fef8-4d07-b06f-b59b573b32d2_W82YF-2Q76Y-63HXB-FGJG9-GF%f%7QX__69_ProfessionalE
46bbed08-9c7b-48fc-a614-95250573f4ea_C29WB-22CC8-VJ326-GHFJW-H9%f%DH4__70_EnterpriseE 46bbed08-9c7b-48fc-a614-95250573f4ea_C29WB-22CC8-VJ326-GHFJW-H9%f%DH4__70_EnterpriseE
@ -3602,12 +3481,12 @@ aaea0dc8-78e1-4343-9f25-b69b83dd1bce_D9GTG-NP7DV-T6JP3-B6B62-JB%f%89R__16_Projec
cbbba2c3-0ff5-4558-846a-043ef9d78559_F4DYN-89BP2-WQTWJ-GR8YC-CK%f%GJG__16_Excel2024Volume_-Excel2024Retail- cbbba2c3-0ff5-4558-846a-043ef9d78559_F4DYN-89BP2-WQTWJ-GR8YC-CK%f%GJG__16_Excel2024Volume_-Excel2024Retail-
bef3152a-8a04-40f2-a065-340c3f23516d_D2F8D-N3Q3B-J28PV-X27HD-RJ%f%WB9__16_Outlook2024Volume_-Outlook2024Retail- bef3152a-8a04-40f2-a065-340c3f23516d_D2F8D-N3Q3B-J28PV-X27HD-RJ%f%WB9__16_Outlook2024Volume_-Outlook2024Retail-
b63626a4-5f05-4ced-9639-31ba730a127e_CW94N-K6GJH-9CTXY-MG2VC-FY%f%CWP__16_PowerPoint2024Volume_-PowerPoint2024Retail- b63626a4-5f05-4ced-9639-31ba730a127e_CW94N-K6GJH-9CTXY-MG2VC-FY%f%CWP__16_PowerPoint2024Volume_-PowerPoint2024Retail-
f510af75-8ab7-4426-a236-1bfb95c34ff8_FQQ23-N4YCY-73HQ3-FM9WC-76%f%HF4__16_ProjectPro2024Volume_-ProjectPro2024Retail- f510af75-8ab7-4426-a236-1bfb95c34ff8_NBBBB-BBBBB-BBBBB-BBBH4-GX%f%3R4__16_ProjectPro2024Volume_-ProjectPro2024Retail-
9f144f27-2ac5-40b9-899d-898c2b8b4f81_PD3TT-NTHQQ-VC7CY-MFXK3-G8%f%7F8__16_ProjectStd2024Volume_-ProjectStd2024Retail- 9f144f27-2ac5-40b9-899d-898c2b8b4f81_PD3TT-NTHQQ-VC7CY-MFXK3-G8%f%7F8__16_ProjectStd2024Volume_-ProjectStd2024Retail-
8d368fc1-9470-4be2-8d66-90e836cbb051_XJ2XN-FW8RK-P4HMP-DKDBV-GC%f%VGB__16_ProPlus2024Volume_-ProPlus2024Retail- 8d368fc1-9470-4be2-8d66-90e836cbb051_NBBBB-BBBBB-BBBBB-BBBJD-VX%f%RPM__16_ProPlus2024Volume_-ProPlus2024Retail-
0002290a-2091-4324-9e53-3cfe28884cde_4NKHF-9HBQF-Q3B6C-7YV34-F6%f%4P3__16_SkypeforBusiness2024Volume 0002290a-2091-4324-9e53-3cfe28884cde_4NKHF-9HBQF-Q3B6C-7YV34-F6%f%4P3__16_SkypeforBusiness2024Volume
bbac904f-6a7e-418a-bb4b-24c85da06187_V28N4-JG22K-W66P8-VTMGK-H6%f%HGR__16_Standard2024Volume_-Home2024Retail-HomeBusiness2024Retail- bbac904f-6a7e-418a-bb4b-24c85da06187_V28N4-JG22K-W66P8-VTMGK-H6%f%HGR__16_Standard2024Volume_-Home2024Retail-HomeBusiness2024Retail-
fa187091-8246-47b1-964f-80a0b1e5d69a_B7TN8-FJ8V3-7QYCP-HQPMV-YY%f%89G__16_VisioPro2024Volume_-VisioPro2024Retail- fa187091-8246-47b1-964f-80a0b1e5d69a_NBBBB-BBBBB-BBBBB-BBBCW-6M%f%X6T__16_VisioPro2024Volume_-VisioPro2024Retail-
923fa470-aa71-4b8b-b35c-36b79bf9f44b_JMMVY-XFNQC-KK4HK-9H7R3-WQ%f%QTV__16_VisioStd2024Volume_-VisioStd2024Retail- 923fa470-aa71-4b8b-b35c-36b79bf9f44b_JMMVY-XFNQC-KK4HK-9H7R3-WQ%f%QTV__16_VisioStd2024Volume_-VisioStd2024Retail-
d0eded01-0881-4b37-9738-190400095098_MQ84N-7VYDM-FXV7C-6K7CC-VF%f%W9J__16_Word2024Volume_-Word2024Retail- d0eded01-0881-4b37-9738-190400095098_MQ84N-7VYDM-FXV7C-6K7CC-VF%f%W9J__16_Word2024Volume_-Word2024Retail-
) do ( ) do (

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -31,28 +31,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -105,8 +103,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
@ -172,8 +168,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -221,7 +216,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -427,23 +421,20 @@ echo:
echo: echo:
echo ____________________________________________________________ echo ____________________________________________________________
echo: echo:
echo [1] Change all editions echo [1] Change - Office Edition
echo [2] Add edition echo [2] Add - Office Edition
echo [3] Remove edition echo [3] Remove - Office Edition
echo:
echo [4] Add/Remove apps
echo ____________________________________________ echo ____________________________________________
echo: echo:
echo [5] Change Office Update Channel echo [4] Change Office Update Channel
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo ____________________________________________________________ echo ____________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,5,0]" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,0]"
choice /C:123450 /N choice /C:12340 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==6 exit /b if !_el!==5 exit /b
if !_el!==5 goto :oe_changeupdchnl if !_el!==4 goto :oe_changeupdchnl
if !_el!==4 goto :oe_editedition
if !_el!==3 goto :oe_removeedition if !_el!==3 goto :oe_removeedition
if !_el!==2 set change=0& goto :oe_edition if !_el!==2 set change=0& goto :oe_edition
if !_el!==1 set change=1& goto :oe_edition if !_el!==1 set change=1& goto :oe_edition
@ -461,12 +452,7 @@ goto :oe_goback
cls cls
if not defined terminal mode 76, 25 if not defined terminal mode 76, 25
if %change%==1 ( title Change Office Edition %masver%
title Change all editions %masver%
) else (
title Add edition %masver%
)
echo: echo:
echo: echo:
echo: echo:
@ -522,23 +508,13 @@ goto :oe_goback
set inpt= set inpt=
set counter=0 set counter=0
set verified=0 set verified=0
set _notfound=
set targetedition= set targetedition=
%line% %line%
echo: echo:
call :dk_color %Gray% "Installed Office editions: %_oIds%" call :dk_color %Gray% "Installed Office editions: %_oIds%"
call :dk_color %Gray% "You can select one of the following Office Editions." call :dk_color %Gray% "You can select one of the following Office Editions."
if %winbuild% LSS 10240 ( if %winbuild% LSS 10240 echo Unsupported products such as 2019/2021/2024 are excluded from this list.
echo Unsupported products such as 2019/2021/2024 are excluded from this list.
) else (
for %%# in (2019 2021 2024) do (
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || (
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
)
)
if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this list because old version [%_version%] of Office is installed."
)
%line% %line%
echo: echo:
@ -568,8 +544,6 @@ if %verified%==0 goto :oe_editionchange
:: Set app exclusions :: Set app exclusions
:oe_excludeappspre
cls cls
set suites= set suites=
echo %list% | find /i "Suites" %nul1% && ( echo %list% | find /i "Suites" %nul1% && (
@ -641,7 +615,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your keyboard:" call :dk_color %_Green% "Choose a menu option using your keyboard:"
choice /C:AENOPJRVWLDT10 /N choice /C:AENOPJRVWLDT10 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==14 goto :oemenu if !_el!==14 goto :oe_editionchangepre
if !_el!==13 call :excludelist & goto :oe_editionchangefinal if !_el!==13 call :excludelist & goto :oe_editionchangefinal
if !_el!==12 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off)) if !_el!==12 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off))
if !_el!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off)) if !_el!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
@ -661,18 +635,18 @@ goto :oe_excludeapps
set excludelist= set excludelist=
for %%# in ( for %%# in (
access Access
excel Excel
onenote OneNote
outlook Outlook
powerpoint PowerPoint
project Project
publisher Publisher
visio Visio
word Word
lync Lync
onedrive OneDrive
teams Teams
) do ( ) do (
if /i "!%%#_st!"=="Off" if defined excludelist (set excludelist=!excludelist!,%%#) else (set excludelist=,%%#) if /i "!%%#_st!"=="Off" if defined excludelist (set excludelist=!excludelist!,%%#) else (set excludelist=,%%#)
) )
@ -743,7 +717,7 @@ goto :oe_goback
:: OfficeClickToRun.exe with productstoadd method is used here to add editions :: OfficeClickToRun.exe with productstoadd method is used here to add editions
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet :: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=Groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
if %change%==1 ( if %change%==1 (
set "c2rcommand=!c2rcommand! productstoremove=AllProducts" set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
@ -770,71 +744,10 @@ goto :oe_goback
::======================================================================================================================================== ::========================================================================================================================================
:: Edit Office edition
:oe_editedition
cls
title Add/Remove Apps %masver%
call :oe_chkinternet
if not defined _int (
goto :oe_goback
)
set change=0
call :ch_getinfo
cls
if not defined terminal (
mode 98, 35
)
set inpt=
set counter=0
set verified=0
set targetedition=
%line%
echo:
call :dk_color %Gray% "You can edit [add/remove apps] one of the following Office editions."
%line%
echo:
for %%A in (%_oIds%) do (
set /a counter+=1
echo [!counter!] %%A
set targetedition!counter!=%%A
)
%line%
echo:
echo [0] Go Back
echo:
call :dk_color %_Green% "Enter an option number using your keyboard and press Enter to confirm:"
set /p inpt=
if "%inpt%"=="" goto :oe_editedition
if "%inpt%"=="0" goto :oemenu
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
set targetedition=!targetedition%inpt%!
if %verified%==0 goto :oe_editedition
::===============
cls
if not defined terminal mode 98, 32
echo %targetedition% | findstr /i "Access Excel OneNote Outlook PowerPoint Project Publisher Skype Visio Word" %nul% && (set list=SingleApps) || (set list=Suites)
goto :oe_excludeappspre
::========================================================================================================================================
:: Remove Office editions :: Remove Office editions
:oe_removeedition :oe_removeedition
title Remove Office editions %masver%
call :ch_getinfo call :ch_getinfo
cls cls
@ -916,7 +829,6 @@ goto :oe_goback
:oe_changeupdchnl :oe_changeupdchnl
title Change Office update channel %masver%
call :ch_getinfo call :ch_getinfo
cls cls
@ -972,12 +884,10 @@ for %%# in (
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do ( for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
set supported= set supported=
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1) if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
if %winbuild% GEQ 10240 ( if %winbuild% GEQ 10240 (if defined ltsc19 echo %%B | findstr /i "LTSC\>" %nul% || set supported=)
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported= if %winbuild% GEQ 10240 (if defined ltsc21 echo %%B | findstr /i "LTSC2021\>" %nul% || set supported=)
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported= if %winbuild% GEQ 10240 (if defined ltsc24 echo %%B | findstr /i "LTSC2024\>" %nul% || set supported=)
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported= if %winbuild% GEQ 10240 (if not defined ltscfound echo %%B | findstr /i "LTSC" %nul% && set supported=)
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
)
if defined supported ( if defined supported (
set /a counter+=1 set /a counter+=1
if !counter! LSS 10 ( if !counter! LSS 10 (
@ -1064,11 +974,7 @@ call :oe_tempcleanup
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -1151,15 +1057,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe" set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
) )
set "audidata4=%_AudienceData:~-4%" echo %_AudienceData% | findstr /i "LTSC\>" %nul% && set ltsc19=LTSC
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021 echo %_AudienceData% | findstr /i "LTSC2021\>" %nul% && set ltsc21=LTSC2021
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024 echo %_AudienceData% | findstr /i "LTSC2024\>" %nul% && set ltsc24=LTSC2024
:: LTSC 2024 build is not fixed yet :: LTSC 2024 build is not fixed yet
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1 if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
@ -1319,15 +1223,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -1337,7 +1238,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -1380,7 +1280,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Common lines used in PowerShell reflection code :: Common lines used in PowerShell reflection code
@ -1420,11 +1320,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -36,28 +36,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -110,8 +108,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
@ -177,8 +173,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -226,7 +221,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -352,17 +346,15 @@ goto dk_done
:: Check Windows Edition and branch :: Check Windows Edition and branch
set osedition= set osedition=0
set dismedition=
set dismnotworking= set dismnotworking=
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "1Current Edition :"') do set "osedition=%%a"
if not defined osedition set dismnotworking=1
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 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%')" 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%')"
if not defined osedition %chkedi% do if not errorlevel 1 (call set "osedition=%%a") %chkedi% do if not errorlevel 1 (call set "osedition=%%a")
if not defined osedition ( if %osedition%==0 (
%eline% %eline%
echo Failed to detect OS edition, aborting... echo Failed to detect OS edition, aborting...
echo: echo:
@ -373,9 +365,12 @@ goto dk_done
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "regedition=%%a" for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "regedition=%%a"
if /i not "%osedition%"=="%regedition%" ( if /i not "%osedition%"=="%regedition%" (
set "showeditionerror=call :dk_color %_Yellow% "[%osedition%] [Reg-%regedition%]."" set "showeditionerror=call :dk_color %_Yellow% "Mismatch found [WMI-%osedition%] [Reg-%regedition%].""
) )
for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition %nul6% ^| find /i "Current Edition :"') do set "dismedition=%%a"
if not defined dismedition set dismnotworking=1
set branch= set branch=
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildBranch %nul6%') do set "branch=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildBranch %nul6%') do set "branch=%%b"
@ -610,7 +605,7 @@ goto dk_done
cls cls
if not defined terminal ( if not defined terminal (
mode con cols=105 lines=32 mode con cols=105 lines=32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
) )
call :ced_rebootflag call :ced_rebootflag
@ -647,7 +642,7 @@ goto dk_done
cls cls
if not defined terminal ( if not defined terminal (
mode con cols=105 lines=32 mode con cols=105 lines=32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
) )
set key= set key=
@ -788,15 +783,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -806,7 +798,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""
@ -876,7 +867,7 @@ echo sc start sppsvc [Error Code: %spperror%]
) )
echo: echo:
%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'}" %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'}"
exit /b exit /b
:: Common lines used in PowerShell reflection code :: Common lines used in PowerShell reflection code
@ -996,11 +987,7 @@ echo:
if %_unattended%==1 timeout /t 2 & exit /b if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -1280,15 +1267,11 @@ if (!$Dism::_DismSetEdition($Session, "$TargetEdition", "$Key", 0, 0, 0)) {
:: Separator = _ :: Separator = _
:: For Windows 10/11 editions, HWID key is listed where ever possible, in Server versions, KMS key is listed where ever possible. :: For Windows 10/11 editions, HWID key is listed where ever possible, in Server versions, KMS key is listed where ever possible.
:: For Windows, generic keys are mentioned till 22000 and for Server, generic keys are mentioned till 17763, later ones are extracted from the pkeyhelper.dll :: Only RS3 and older version Generic keys are stored here, later ones are extracted from the pkeyhelper.dll itself
:changeeditiondata :changeeditiondata
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
if %winbuild% GTR 17763 exit /b if %winbuild% GTR 17763 exit /b
) else (
if %winbuild% GEQ 22000 exit /b
)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=) if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
set h= set h=
@ -1306,12 +1289,8 @@ YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education
84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN 84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN
KCNVH-YKWX8-GJJB9-H9FDT-6F7%h%W2__Volume:MAK_EnterpriseS_VB
43TBQ-NH92J-XKTM7-KT3KK-P39%h%PB__OEM:NONSLP_EnterpriseS_RS5
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1 NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%h%PT__Volume:MAK_EnterpriseSN_VB
M33WV-NHY3C-R7FPM-BQGPT-239%h%PG__Volume:MAK_EnterpriseSN_RS5
2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1 2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage
@ -1323,10 +1302,6 @@ GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN 46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN
NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh
XQQYW-NFFMW-XJPBH-K8732-CKF%h%FD______OEM:DM_IoTEnterprise
QPM6N-7J2WJ-P88HH-P3YRH-YY7%h%4H__OEM:NONSLP_IoTEnterpriseS
K9VKN-3BGWV-Y624W-MCRMQ-BHD%h%CD______Retail_CloudEditionN
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%h%4W______Retail_CloudEdition
V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE 2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -31,28 +31,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -105,8 +103,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
@ -171,8 +167,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -220,7 +215,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -707,11 +701,7 @@ echo ______________________________________________________________
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -739,15 +729,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -757,7 +744,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""

View File

@ -1,4 +1,4 @@
@set masver=2.8 @set masver=2.7
@echo off @echo off
@ -31,28 +31,26 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
set re1=
set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="r2" set r2=1
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows :: 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 :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1" start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
exit /b exit /b
) )
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows :: 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 re2 ( if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2" start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
exit /b exit /b
) )
@ -105,8 +103,6 @@ set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
if defined _args set _args=%_args:re1=%
if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
@ -172,8 +168,7 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo: echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working. echo Failed to run Powershell command but Powershell is working.
echo: call :dk_color %Blue% "Check if your antivirus is blocking the script."
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: echo:
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
@ -221,7 +216,6 @@ if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= %psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
) )
if defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
@ -467,7 +461,7 @@ goto :at_back
cls cls
if not defined terminal ( if not defined terminal (
mode 125, 32 mode 125, 32
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=31;$B.Height=200;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
) )
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^) title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^)
@ -599,7 +593,7 @@ echo [Successful]
echo: echo:
echo Restarting wlidsvc ^& LicenseManager services... echo Restarting wlidsvc ^& LicenseManager services...
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null") for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
::======================================================================================================================================== ::========================================================================================================================================
@ -790,6 +784,14 @@ echo:
call :dk_color %Blue% "Repairing Office licenses..." call :dk_color %Blue% "Repairing Office licenses..."
echo: echo:
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE') do set arch=%%b
if /i "%arch%"=="x86" (
set arch=X86
) else (
set arch=X64
)
for %%# in (68 86) do ( for %%# in (68 86) do (
for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%%#=) for %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%%#=)
) )
@ -807,10 +809,10 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v P
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2rrepair c2r16repair86 OfficeClickToRun.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2rrepair c2r16repair68 OfficeClickToRun.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
set uwp16= set uwp16=
if %winbuild% GEQ 10240 ( if %winbuild% GEQ 10240 (
@ -871,8 +873,11 @@ pause %nul1%
if defined uwp16 ( if defined uwp16 (
echo: echo:
echo Skipping repair for Office 16.0 UWP... echo Note: Skipping repair for Office 16.0 UWP...
echo You need to use the Reset option in Windows Settings instead.
echo ________________________________________________________________
echo: echo:
start ms-settings:appsfeatures
) )
set c2r14= set c2r14=
@ -881,8 +886,11 @@ if defined c2r14_86 set c2r14=1
if defined c2r14 ( if defined c2r14 (
echo: echo:
echo Skipping repair for Office 14.0 C2R... echo Note: Skipping repair for Office 14.0 C2R...
echo You need to use the Repair option in Windows Settings for it.
echo ________________________________________________________________
echo: echo:
start appwiz.cpl
) )
if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%" if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
@ -905,15 +913,6 @@ echo:
call :dk_color %Green% "Finished" call :dk_color %Green% "Finished"
goto :at_back goto :at_back
:getc2rrepair
for %%# in (X86 X64) do (
if exist "%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2" (
set "%1=%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2"
)
)
exit /b
:getrepairsetup :getrepairsetup
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe" set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
@ -1078,7 +1077,7 @@ if %errorlevel% NEQ 0 (set error=1& exit /b)
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM SoftwareLicensingService').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% %psc% "try { $null=([WMISEARCHER]'SELECT * FROM SoftwareLicensingService').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
cmd /c exit /b %errorlevel% cmd /c exit /b %errorlevel%
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440" %nul1%
if %errorlevel% EQU 0 set error=1 if %errorlevel% EQU 0 set error=1
exit /b exit /b
@ -1139,8 +1138,6 @@ exit /b
set permerror= set permerror=
if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder" if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder"
if defined ps32onArm exit /b
for %%# in ( for %%# in (
"%tokenstore%+FullControl" "%tokenstore%+FullControl"
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey" "HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
@ -1384,11 +1381,7 @@ $key.SetAccessControl($acl)
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color %White% " " call :dk_color2 %Blue% "Press [1] to open Troubleshoot page " %Gray% " Press [0] to ignore"
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 choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
) )
@ -1436,15 +1429,12 @@ set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 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) 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 ( if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a" for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m"" set "Red="41;97m""
set "Gray="100;97m"" set "Gray="100;97m""
set "Green="42;97m"" set "Green="42;97m""
set "Blue="44;97m"" set "Blue="44;97m""
set "White="107;91m""
set "_Red="40;91m"" set "_Red="40;91m""
set "_White="40;37m"" set "_White="40;37m""
set "_Green="40;92m"" set "_Green="40;92m""
@ -1454,7 +1444,6 @@ set "Red="Red" "white""
set "Gray="Darkgray" "white"" set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white"" set "Green="DarkGreen" "white""
set "Blue="Blue" "white"" set "Blue="Blue" "white""
set "White="White" "Red""
set "_Red="Black" "Red"" set "_Red="Black" "Red""
set "_White="Black" "Gray"" set "_White="Black" "Gray""
set "_Green="Black" "Green"" set "_Green="Black" "Green""

View File

@ -2,7 +2,13 @@
<h1 align="center">Microsoft Activation Scripts (MAS)</h1> <h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p> <p align="center">A Windows and Office activator using HWID / Ohook / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
<p align="center">
<a href="https://discord.gg/tVFN4N84PP"><img src="https://img.shields.io/badge/Chat%20with%20us%20on%20Discord--blue?style=social&logo=discord" alt="Chat with us without signup" title="Chat with us without signup"></a>
<a href="https://www.reddit.com/r/MAS_Activator"><img src="https://img.shields.io/badge/MAS%20on%20Reddit--orange?style=social&logo=reddit" alt="MAS on Reddit" title="MAS on Reddit"></a>
<a href="https://twitter.com/massgravel"><img src="https://img.shields.io/twitter/follow/massgravel" alt="Follow us on X" title="Follow us on X"></a>
</p>
<hr> <hr>
@ -15,76 +21,42 @@
``` ```
irm https://get.activated.win | iex irm https://get.activated.win | iex
``` ```
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation. or (deprecated, will be retired on Dec 31 2024, use above instead)
4. That's all.
<details>
<summary>More options</summary>
- Alternatively, you can use the following (It will be deprecated in the future.)
``` ```
irm https://massgrave.dev/get | iex irm https://massgrave.dev/get | iex
``` ```
- The URL `get.activated.win` might be blocked by some DNS services because it is a new domain. 3. You will see the activation options. Choose [1] HWID for Windows activation. Choose [2] Ohook for Office activation.
4. That's all.
</details>
--- ---
- On older Windows builds you may need to run the below command before,
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
### Method 2 - Traditional (Windows 7 and later) ### Method 2 - Traditional (Windows 7 and later)
<details> 1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) / [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts) / [Self-hosted Git](https://git.activated.win/massgrave/Microsoft-Activation-Scripts)
<summary>Click here for info</summary>
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts) or [Self-hosted Git](https://git.activated.win/massgrave/Microsoft-Activation-Scripts)
2. Right-click on the downloaded zip file and extract 2. Right-click on the downloaded zip file and extract
3. In the extracted folder, find the folder named `All-In-One-Version` 3. In the extracted folder, find the folder named `All-In-One-Version`
4. Run the file named `MAS_AIO.cmd` 4. Run the file named `MAS_AIO.cmd`
5. You will see the activation options, follow the on-screen instructions. 5. You will see the activation options, follow the on-screen instructions.
6. That's all. 6. That's all.
</details> To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
--- </br>
> [!NOTE]
>
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
---
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
``` ```
Latest Version: 2.8 Latest Version: 2.7
Release date: 9-Nov-2024 Release date: 6-Sep-2024
``` ```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot) ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media) ### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
### Homepage - [https://massgrave.dev/](https://massgrave.dev/) ### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
<div align="center">
[![1.1]][1]
[![1.2]][2]
[![1.3]][3]
[![1.4]][4]
</div>
[1.1]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
[1.2]: https://massgrave.dev/img/logo_github.png (GitHub)
[1.3]: https://massgrave.dev/img/logo_reddit.png (Reddit)
[1.4]: https://massgrave.dev/img/logo_x.png (Follow us on X)
[1]: https://discord.gg/tVFN4N84PP
[2]: https://github.com/massgravel/Microsoft-Activation-Scripts
[3]: https://www.reddit.com/r/MAS_Activator
[4]: https://twitter.com/massgravel
--- ---
<p align="center">Made with Love ❤️</p> <p align="center">Made with Love ❤️</p>