mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2024-11-21 14:17:11 +00:00
Compare commits
46 commits
07ad5a208d
...
bbdc9bdfd8
Author | SHA1 | Date | |
---|---|---|---|
bbdc9bdfd8 | |||
7d036f57fd | |||
ab90514b0a | |||
25abc1f457 | |||
873c4bc4d8 | |||
0b402d9afe | |||
5141866f0a | |||
f0618824a4 | |||
03cc88193d | |||
897a9db808 | |||
9bbd02cc91 | |||
d1dca45710 | |||
5e71252993 | |||
1db017f1f1 | |||
d06ba7fc4c | |||
99954a9056 | |||
fcb710a48a | |||
0cbaa141c3 | |||
9d1964ceda | |||
0477cf13e1 | |||
9b568d4b4e | |||
1c9fe0815e | |||
a5dd99ac00 | |||
1849dd3075 | |||
8fe0b24945 | |||
7c69c471c5 | |||
f32cb934dc | |||
7a6e63a462 | |||
d76b2ea57e | |||
1f0e04519a | |||
d059952ecd | |||
6efb5d50fe | |||
b2831795a4 | |||
4e8ebecd3d | |||
d929cd8fa0 | |||
d384c5f2f7 | |||
643d4f077f | |||
db26b75b64 | |||
b80a502086 | |||
db218720f3 | |||
b8504cc21e | |||
2e6bfa94c2 | |||
a1244dcb3b | |||
06695612a8 | |||
323c6808af | |||
841d856a29 |
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -143,6 +145,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/HWID" set _act=1
|
||||
|
@ -215,7 +219,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -263,6 +268,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -537,14 +543,14 @@ echo Generating GenuineTicket.xml [Successful]
|
|||
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_xmlexist% (
|
||||
set error=1
|
||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -606,7 +612,7 @@ echo:
|
|||
set error=1
|
||||
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
|
||||
)
|
||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
|
||||
call :dk_refresh
|
||||
call :dk_act
|
||||
call :dk_checkperm
|
||||
|
@ -675,7 +681,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucor
|
|||
if defined wucorrupt (
|
||||
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
||||
) else (
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null"
|
||||
sc query wuauserv | find /i "RUNNING" %nul% || (
|
||||
set wuerror=1
|
||||
sc start wuauserv %nul%
|
||||
|
@ -749,12 +755,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -764,6 +773,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -940,7 +950,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Get Activation IDs from licensing files if not found through WMI
|
||||
|
@ -1009,7 +1019,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1063,26 +1073,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1098,6 +1098,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -1189,7 +1196,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -1219,14 +1226,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -1260,7 +1274,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -1303,7 +1321,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
|
@ -1345,17 +1363,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -1376,7 +1397,7 @@ echo Checking SPP In IFEO [%_sppint%]
|
|||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -1425,7 +1446,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -1450,6 +1471,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -1458,7 +1480,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -1592,7 +1614,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -47,26 +47,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -146,6 +148,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/KMS38" set _act=1
|
||||
|
@ -218,7 +222,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -266,6 +271,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -516,18 +522,29 @@ call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Acti
|
|||
)
|
||||
|
||||
if not defined key if not defined _gvlk (
|
||||
%eline%
|
||||
echo:
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support KMS38 activation.
|
||||
echo Make sure you are using the latest version of the script.
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
) else (
|
||||
echo Required license files were not found in %SysPath%\spp\tokens\skus\
|
||||
|
||||
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||
|
||||
if defined skunotfound (
|
||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if defined sppks (
|
||||
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
|
||||
if not defined skunotfound if not defined sppks (
|
||||
call :dk_color %Red% "This product does not support KMS38 activation."
|
||||
call :dk_color %Blue% "Make sure you are using the latest version of the script."
|
||||
set fixes=%fixes% %mas%
|
||||
echo %mas%
|
||||
)
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
|
@ -651,7 +668,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||
|
||||
:: Stop sppsvc
|
||||
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
|
||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
||||
echo Stopping sppsvc Service [Successful]
|
||||
|
@ -660,14 +677,14 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|||
)
|
||||
|
||||
%_xmlexist% (
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
%_xmlexist% timeout /t 2 %nul%
|
||||
|
||||
%_xmlexist% (
|
||||
set error=1
|
||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -860,12 +877,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -875,6 +895,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1067,7 +1088,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
||||
|
@ -1118,7 +1139,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1217,26 +1238,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1252,6 +1263,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -1343,7 +1361,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -1373,14 +1391,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -1414,7 +1439,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -1457,7 +1486,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
|
@ -1499,17 +1528,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -1530,7 +1562,7 @@ echo Checking SPP In IFEO [%_sppint%]
|
|||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -1579,7 +1611,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -1604,6 +1636,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -1612,7 +1645,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -1746,7 +1779,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -143,6 +145,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="/Ohook" set _act=1
|
||||
|
@ -208,7 +212,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -256,6 +261,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -350,7 +356,7 @@ cls
|
|||
if not defined terminal (
|
||||
mode 130, 32
|
||||
if exist "%SysPath%\spp\store_test\" mode 134, 32
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
title Ohook Activation %masver%
|
||||
|
||||
|
@ -410,11 +416,14 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v P
|
|||
%nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
|
||||
%nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
|
||||
if %winbuild% GEQ 10240 (
|
||||
for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" set o16uwp=Office UWP )
|
||||
)
|
||||
|
||||
if not "%o14msi%%o14c2r%%o16uwp%"=="" (
|
||||
echo:
|
||||
call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]"
|
||||
if not "%o14msi%%o16uwp%"=="" call :dk_color %Blue% "Use Online KMS option to activate it."
|
||||
)
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
|
||||
|
@ -704,7 +713,12 @@ reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
|||
reg query HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && reg delete HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f
|
||||
reg unload HKU\DEF_TEMP %nul%
|
||||
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty $('{0}\{1}' -f $p, $_.PSChildName)).ProfileImagePath; if ($pi -like $('{0}\Users\*' -f $Env:SystemDrive)) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
set _sidlist=
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
|
||||
if not defined _sidlist (
|
||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||
)
|
||||
|
||||
for %%# in (!_sidlist!) do (
|
||||
|
||||
|
@ -839,14 +853,15 @@ exit /b
|
|||
|
||||
if not defined _oLPath exit /b
|
||||
|
||||
if defined _oIntegrator (
|
||||
if %oVer%==16 (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
|
||||
) else (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
|
||||
)
|
||||
|
||||
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
|
||||
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
|
||||
)
|
||||
|
||||
:: Fallback to manual method to install licenses incase integrator.exe is not working
|
||||
|
||||
|
@ -1106,19 +1121,10 @@ set _sortIds=!_sortIds:PreInstallR_=Retail_!
|
|||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||
|
||||
set _sidlist=
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like """"$Env:SystemDrive\Users\*"""" -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
|
||||
if not defined _sidlist (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1126,16 +1132,18 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|||
:: Load the unloaded useraccounts registry
|
||||
|
||||
set loadedsids=
|
||||
set failedtoload=
|
||||
set failedtounload=
|
||||
set alrloadedsids=
|
||||
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg query HKU\%%#\Software %nul% || (
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||
) || (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "loadedsids=%%loadedsids%% %%#"
|
||||
) || (
|
||||
set failedtoload=1
|
||||
reg unload HKU\%%# %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1143,6 +1151,23 @@ set failedtoload=1
|
|||
|
||||
::==========================
|
||||
|
||||
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% EQU 0 (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||
|
||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||
|
@ -1163,6 +1188,23 @@ reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f %
|
|||
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f /reg:32 %nul%
|
||||
)
|
||||
|
||||
:: Clear vNext in UWP Office
|
||||
|
||||
if defined o16uwpapplist (
|
||||
for %%# in (%_sidlist%) do (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\LocalCache\Local\Microsoft\Office\Licenses\" %nul%
|
||||
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
|
||||
set defname=DEFTEMP-%%#
|
||||
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Identity /f %nul%
|
||||
reg unload HKU\!defname! %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
:: Clear SharedComputerLicensing for office
|
||||
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
|
||||
|
||||
|
@ -1197,18 +1239,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
|||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||
:: Resiliency registry entry can skip this check
|
||||
|
||||
set defname=DEFTEMP-%random%
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||
|
||||
if defined o16c2r if defined officeact (
|
||||
reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
||||
reg query HKU\DEF_TEMP %nul% || set failedtoload=1
|
||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
reg unload HKU\DEF_TEMP %nul%
|
||||
reg query HKU\DEF_TEMP %nul% && set failedtounload=1
|
||||
if exist "%defdat%\NTUSER.DAT" (
|
||||
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||
reg query HKU\%defname%\Software %nul% && (
|
||||
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
reg unload HKU\%defname% %nul%
|
||||
)
|
||||
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1217,19 +1264,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
|||
|
||||
for %%# in (%loadedsids%) do (
|
||||
reg unload HKU\%%# %nul%
|
||||
reg query HKU\%%# %nul% && set failedtounload=1
|
||||
)
|
||||
|
||||
if defined failedtoload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
if defined failedtounload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
@ -1326,12 +1360,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -1341,6 +1378,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1417,6 +1455,22 @@ set allapps=
|
|||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
|
||||
|
||||
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
|
||||
|
||||
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
||||
set len=0
|
||||
echo:!allapps!> %SystemRoot%\Temp\chklen
|
||||
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
|
||||
del %SystemRoot%\Temp\chklen %nul%
|
||||
|
||||
if !len! GTR 6000 (
|
||||
%eline%
|
||||
echo Too many licenses are installed, the script may crash.
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
timeout /t 30
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
:: Get installed products Activation IDs
|
||||
|
@ -1477,7 +1531,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -1515,26 +1569,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -1550,6 +1594,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -1641,7 +1692,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -1671,14 +1722,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -1712,7 +1770,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -1755,7 +1817,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
|
@ -1797,17 +1859,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -1828,7 +1893,7 @@ echo Checking SPP In IFEO [%_sppint%]
|
|||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -1877,7 +1942,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -1902,6 +1967,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -1910,7 +1976,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -2044,7 +2110,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -2119,15 +2189,15 @@ for %%# in (
|
|||
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
|
||||
:: Office 365 - 15.0 version
|
||||
15_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
|
||||
15_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail
|
||||
15_537ea5b5-7d50-4876-bd38-a53a77caca32_J2W28-TN9C8-26PWV-F7J4G-72%f%XCB_Subscription1_O365HomePremRetail
|
||||
15_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
|
||||
15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail
|
||||
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
|
||||
:: Office 365 - 16.0 version
|
||||
16_6337137e-7c07-4197-8986-bece6a76fc33_2P3C9-BQNJH-VCVPH-YDY6M-43%f%JPQ_Subscription__O365BusinessRetail
|
||||
16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_Y9NF9-M2QWD-FF6RJ-QJW36-RR%f%F2T_SubTest_______O365BusinessRetail
|
||||
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_149dbce7-a48e-44db-8364-a53386cd4580_2N382-D6PKK-QTX4D-2JJYK-M9%f%6P2_Subscription1_O365ProPlusRetail
|
||||
16_e3dacc06-3bc2-4e13-8e59-8e05f3232325_H8DN8-Y2YP3-CR9JT-DHDR9-C7%f%GP3_Subscription2_O365ProPlusRetail
|
||||
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_HN8JP-87TQJ-PBF3P-Y66KC-W2%f%K9V_Subscription1_O365SmallBusPremRetail
|
||||
:: Office 2016
|
||||
16_bfa358b0-98f1-4125-842e-585fa13032e6_WHK4N-YQGHB-XWXCC-G3HYC-6J%f%F94_Retail________AccessRetail
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -69,26 +69,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -169,6 +171,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" (set _elev=1)
|
||||
if /i "%%A"=="/K-Windows" (set _actwin=1)
|
||||
|
@ -237,7 +241,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -285,6 +290,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -410,7 +416,7 @@ cls
|
|||
if not defined terminal (
|
||||
mode 115, 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;}"
|
||||
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
|
||||
)
|
||||
title Online %KS% Activation %masver%
|
||||
|
||||
|
@ -556,15 +562,30 @@ call :dk_color %Red% "Checking Alternate Edition For %KS% [%altedition% Act
|
|||
|
||||
if not defined key if not defined _gvlk (
|
||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||
if not defined skunotfound (
|
||||
echo This product does not support %KS% 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\
|
||||
|
||||
if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||
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
|
||||
)
|
||||
echo:
|
||||
goto :ks_office
|
||||
)
|
||||
|
@ -627,18 +648,14 @@ call :dk_color %Gray% "Checking Ohook [Ohook activation
|
|||
:: Check unsupported office versions
|
||||
|
||||
set o14c2r=
|
||||
set o16uwp=
|
||||
|
||||
set _68=HKLM\SOFTWARE\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 %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.Office.Desktop"" | find /i "Office" %nul1% && set o16uwp=Office UWP
|
||||
|
||||
if not "%o14c2r%%o16uwp%"=="" (
|
||||
if not "%o14c2r%"=="" (
|
||||
echo:
|
||||
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]"
|
||||
call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%]"
|
||||
)
|
||||
|
||||
if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && (
|
||||
|
@ -651,6 +668,13 @@ set ohub=1
|
|||
|
||||
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%
|
||||
set error1=%errorlevel%
|
||||
|
||||
|
@ -671,10 +695,10 @@ set o15c2r=
|
|||
set error=1
|
||||
)
|
||||
|
||||
if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
|
||||
if "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" (
|
||||
set error=1
|
||||
echo:
|
||||
if not "%o14c2r%%o16uwp%"=="" (
|
||||
if not "%o14c2r%"=="" (
|
||||
call :dk_color %Red% "Checking Supported Office Install [Not Found]"
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Installed Office [Not Found]"
|
||||
|
@ -691,8 +715,8 @@ goto :ks_activate
|
|||
)
|
||||
|
||||
set multioffice=
|
||||
if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
|
||||
if not "%o14c2r%%o16uwp%"=="" set multioffice=1
|
||||
if not "%o16uwp%%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1
|
||||
if not "%o14c2r%"=="" set multioffice=1
|
||||
|
||||
if defined multioffice (
|
||||
echo:
|
||||
|
@ -701,6 +725,46 @@ 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
|
||||
|
||||
if not defined o15c2r goto :ks_starto16c2r
|
||||
|
@ -791,7 +855,7 @@ if defined o16msi call :ks_processmsi 16 %o16msi_reg%
|
|||
|
||||
echo:
|
||||
call :oh_clearblock
|
||||
if "%o16msi%%o15msi%"=="" if not "%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey
|
||||
if "%o16msi%%o15msi%"=="" if not "%o16uwp%%o16c2r%%o15c2r%"=="" if "%keyerror%"=="0" if %_NoEditionChange%==0 call :oh_uninstkey
|
||||
call :oh_licrefresh
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -990,6 +1054,8 @@ exit /b
|
|||
|
||||
:ks_osppready
|
||||
|
||||
if not defined _config exit /b
|
||||
|
||||
echo: %_config% | find /i "propertyBag" %nul1% && (
|
||||
set "_osppt=REG_DWORD"
|
||||
set "_osppready=%o15c2r_reg%"
|
||||
|
@ -1156,14 +1222,15 @@ exit /b
|
|||
|
||||
if not defined _oLPath exit /b
|
||||
|
||||
if defined _oIntegrator (
|
||||
if %oVer%==16 (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License%.16 PidKey=%key% %nul%
|
||||
) else (
|
||||
"!_oIntegrator!" /I /License PRIDName=%_License% PidKey=%key% %nul%
|
||||
)
|
||||
|
||||
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
|
||||
echo "!allapps!" | find /i "!_actid!" %nul1% && exit /b
|
||||
)
|
||||
|
||||
:: Fallback to manual method to install licenses incase integrator.exe is not working
|
||||
|
||||
|
@ -1207,19 +1274,10 @@ exit /b
|
|||
:: https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state
|
||||
|
||||
set _sidlist=
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like """"$Env:SystemDrive\Users\*"""" -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_ -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
for /f "tokens=* delims=" %%a in ('%psc% "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$')) { Split-Path $_.PSPath -Leaf } }" %nul6%') do (if defined _sidlist (set _sidlist=!_sidlist! %%a) else (set _sidlist=%%a))
|
||||
|
||||
if not defined _sidlist (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
for /f "delims=" %%a in ('%psc% "$explorerProc = Get-Process -Name explorer | Where-Object {$_.SessionId -eq (Get-Process -Id $pid).SessionId} | Select-Object -First 1; $sid = (gwmi -Query ('Select * From Win32_Process Where ProcessID=' + $explorerProc.Id)).GetOwnerSid().Sid; $sid" %nul6%') do (set _sidlist=%%a)
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1227,16 +1285,18 @@ call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
|||
:: Load the unloaded useraccounts registry
|
||||
|
||||
set loadedsids=
|
||||
set failedtoload=
|
||||
set failedtounload=
|
||||
set alrloadedsids=
|
||||
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg query HKU\%%#\Software %nul% || (
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "alrloadedsids=%%alrloadedsids%% %%#"
|
||||
) || (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
reg load HKU\%%# "%%b\NTUSER.DAT" %nul%
|
||||
reg query HKU\%%#\Software %nul% && (
|
||||
call set "loadedsids=%%loadedsids%% %%#"
|
||||
) || (
|
||||
set failedtoload=1
|
||||
reg unload HKU\%%# %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1244,6 +1304,23 @@ set failedtoload=1
|
|||
|
||||
::==========================
|
||||
|
||||
set "_sidlist=%loadedsids% %alrloadedsids%"
|
||||
|
||||
set /a counter=0
|
||||
for %%# in (%_sidlist%) do set /a counter+=1
|
||||
|
||||
if %counter% EQU 0 (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking User Accounts SID [Not Found]"
|
||||
exit /b
|
||||
)
|
||||
|
||||
if %counter% GTR 10 (
|
||||
call :dk_color %Gray% "Checking Total User Accounts [%counter%]"
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
||||
:: Clear the vNext/shared/device license blocks which may prevent ohook activation
|
||||
|
||||
rmdir /s /q "%ProgramData%\Microsoft\Office\Licenses\" %nul%
|
||||
|
@ -1264,6 +1341,23 @@ reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f %
|
|||
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Office\%%x.0\Common\Licensing" /f /reg:32 %nul%
|
||||
)
|
||||
|
||||
:: Clear vNext in UWP Office
|
||||
|
||||
if defined o16uwpapplist (
|
||||
for %%# in (%_sidlist%) do (
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%%#" /v ProfileImagePath" %nul6%') do (
|
||||
rmdir /s /q "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\LocalCache\Local\Microsoft\Office\Licenses\" %nul%
|
||||
if exist "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" (
|
||||
set defname=DEFTEMP-%%#
|
||||
reg load HKU\!defname! "%%b\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium\User.dat" %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Licensing /f %nul%
|
||||
reg delete HKU\!defname!\Software\Microsoft\Office\16.0\Common\Identity /f %nul%
|
||||
reg unload HKU\!defname! %nul%
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
:: Clear SharedComputerLicensing for office
|
||||
:: https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
|
||||
|
||||
|
@ -1298,18 +1392,23 @@ echo Clearing Office License Blocks [Successfully cleared from all %cou
|
|||
:: Some retail products attempt to validate the license and may show a banner "There was a problem checking this device's license status."
|
||||
:: Resiliency registry entry can skip this check
|
||||
|
||||
set defname=DEFTEMP-%random%
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v Default" %nul6%') do call set "defdat=%%b"
|
||||
|
||||
if defined o16c2r if defined officeact (
|
||||
reg load HKU\DEF_TEMP %SystemDrive%\Users\Default\NTUSER.DAT %nul%
|
||||
reg query HKU\DEF_TEMP %nul% || set failedtoload=1
|
||||
reg add HKU\DEF_TEMP\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
reg unload HKU\DEF_TEMP %nul%
|
||||
reg query HKU\DEF_TEMP %nul% && set failedtounload=1
|
||||
if exist "%defdat%\NTUSER.DAT" (
|
||||
reg load HKU\%defname% "%defdat%\NTUSER.DAT" %nul%
|
||||
reg query HKU\%defname%\Software %nul% && (
|
||||
reg add HKU\%defname%\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
reg unload HKU\%defname% %nul%
|
||||
)
|
||||
|
||||
for %%# in (%_sidlist%) do (
|
||||
reg delete HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /f %nul%
|
||||
reg add HKU\%%#\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency /v "TimeOfLastHeartbeatFailure" /t REG_SZ /d "2040-01-01T00:00:00Z" /f %nul%
|
||||
)
|
||||
echo Adding Reg Keys to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
echo Adding Registry to Skip License Check [Successfully added to all %counter% ^& future new user accounts]
|
||||
)
|
||||
|
||||
::==========================
|
||||
|
@ -1318,19 +1417,6 @@ echo Adding Reg Keys to Skip License Check [Successfully added to all %counter
|
|||
|
||||
for %%# in (%loadedsids%) do (
|
||||
reg unload HKU\%%# %nul%
|
||||
reg query HKU\%%# %nul% && set failedtounload=1
|
||||
)
|
||||
|
||||
if defined failedtoload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Loading Unloaded Accounts Registry [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
if defined failedtounload (
|
||||
set error=1
|
||||
call :dk_color %Red% "Unloading Loaded Account Registries [Failed for some user accounts]"
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
@ -2226,12 +2312,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -2241,6 +2330,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -2389,6 +2479,22 @@ set allapps=
|
|||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
|
||||
|
||||
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
|
||||
|
||||
if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 (
|
||||
set len=0
|
||||
echo:!allapps!> %SystemRoot%\Temp\chklen
|
||||
for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA)
|
||||
del %SystemRoot%\Temp\chklen %nul%
|
||||
|
||||
if !len! GTR 6000 (
|
||||
%eline%
|
||||
echo Too many licenses are installed, the script may crash.
|
||||
call :dk_color %Blue% "%_fixmsg%"
|
||||
timeout /t 30
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
:: Get installed products Activation IDs
|
||||
|
@ -2414,7 +2520,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||
exit /b
|
||||
|
||||
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
||||
|
@ -2465,7 +2571,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||
|
@ -2564,26 +2670,16 @@ exit /b
|
|||
|
||||
set w=
|
||||
set results=
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
||||
set pupfound=%pupfound1%%pupfound2%
|
||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||
if not defined pupfound (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||
)
|
||||
|
||||
set hcount=0
|
||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||
|
||||
set wucount=0
|
||||
for %%# in (wuauserv) do (
|
||||
set _corrupt=
|
||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
||||
)
|
||||
)
|
||||
if %wucount% GEQ 1 set "results=%results%[Windows Update registry is corrupt]"
|
||||
|
||||
sc start sppsvc %nul%
|
||||
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||
set "results=%results%[Likely File Infector]"
|
||||
|
@ -2599,6 +2695,13 @@ set fixes=%fixes% %mas%remove_mal%w%ware
|
|||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
echo:
|
||||
)
|
||||
|
||||
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||
|
||||
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
@ -2690,7 +2793,7 @@ set errorcode=
|
|||
set checkerror=
|
||||
|
||||
sc query %%# | find /i "RUNNING" %nul% || (
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set errorcode=!errorlevel!
|
||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||
)
|
||||
|
@ -2720,14 +2823,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||
)
|
||||
|
||||
|
||||
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||
|
||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||
|
||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
set showfix=1
|
||||
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||
)
|
||||
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -2761,7 +2871,11 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
|||
|
||||
|
||||
set osedition=0
|
||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||
|
||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||
|
||||
|
@ -2804,7 +2918,7 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||
|
||||
if %errorlevel% NEQ 0 set wmifailed=1
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||
if defined wmifailed (
|
||||
set error=1
|
||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||
|
@ -2846,17 +2960,20 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||
|
||||
if exist "%SysPath%\wlms\wlms.exe" (
|
||||
sc query wlms | find /i "RUNNING" %nul% && (
|
||||
if %winbuild% LSS 9200 (
|
||||
echo Checking Eval WLMS Service [Found]
|
||||
) else (
|
||||
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||
set error=1
|
||||
set showfix=1
|
||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
)
|
||||
|
||||
|
||||
|
@ -2877,7 +2994,7 @@ echo Checking SPP In IFEO [%_sppint%]
|
|||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||
set error=1
|
||||
)
|
||||
|
||||
|
@ -2926,7 +3043,7 @@ set showfix=1
|
|||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||
|
@ -2951,6 +3068,7 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
@ -2959,7 +3077,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, Syste
|
|||
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||
|
||||
set permerror=
|
||||
if %winbuild% GEQ 9200 (
|
||||
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -3093,7 +3211,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -3361,7 +3483,6 @@ 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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -3481,12 +3602,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-
|
||||
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-
|
||||
f510af75-8ab7-4426-a236-1bfb95c34ff8_NBBBB-BBBBB-BBBBB-BBBH4-GX%f%3R4__16_ProjectPro2024Volume_-ProjectPro2024Retail-
|
||||
f510af75-8ab7-4426-a236-1bfb95c34ff8_FQQ23-N4YCY-73HQ3-FM9WC-76%f%HF4__16_ProjectPro2024Volume_-ProjectPro2024Retail-
|
||||
9f144f27-2ac5-40b9-899d-898c2b8b4f81_PD3TT-NTHQQ-VC7CY-MFXK3-G8%f%7F8__16_ProjectStd2024Volume_-ProjectStd2024Retail-
|
||||
8d368fc1-9470-4be2-8d66-90e836cbb051_NBBBB-BBBBB-BBBBB-BBBJD-VX%f%RPM__16_ProPlus2024Volume_-ProPlus2024Retail-
|
||||
8d368fc1-9470-4be2-8d66-90e836cbb051_XJ2XN-FW8RK-P4HMP-DKDBV-GC%f%VGB__16_ProPlus2024Volume_-ProPlus2024Retail-
|
||||
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-
|
||||
fa187091-8246-47b1-964f-80a0b1e5d69a_NBBBB-BBBBB-BBBBB-BBBCW-6M%f%X6T__16_VisioPro2024Volume_-VisioPro2024Retail-
|
||||
fa187091-8246-47b1-964f-80a0b1e5d69a_B7TN8-FJ8V3-7QYCP-HQPMV-YY%f%89G__16_VisioPro2024Volume_-VisioPro2024Retail-
|
||||
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-
|
||||
) do (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -103,6 +105,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
|
@ -168,7 +172,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -216,6 +221,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -421,20 +427,23 @@ echo:
|
|||
echo:
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
echo [1] Change - Office Edition
|
||||
echo [2] Add - Office Edition
|
||||
echo [3] Remove - Office Edition
|
||||
echo [1] Change all editions
|
||||
echo [2] Add edition
|
||||
echo [3] Remove edition
|
||||
echo:
|
||||
echo [4] Add/Remove apps
|
||||
echo ____________________________________________
|
||||
echo:
|
||||
echo [4] Change Office Update Channel
|
||||
echo [5] Change Office Update Channel
|
||||
echo [0] %_exitmsg%
|
||||
echo ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,0]"
|
||||
choice /C:12340 /N
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3,4,5,0]"
|
||||
choice /C:123450 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==5 exit /b
|
||||
if !_el!==4 goto :oe_changeupdchnl
|
||||
if !_el!==6 exit /b
|
||||
if !_el!==5 goto :oe_changeupdchnl
|
||||
if !_el!==4 goto :oe_editedition
|
||||
if !_el!==3 goto :oe_removeedition
|
||||
if !_el!==2 set change=0& goto :oe_edition
|
||||
if !_el!==1 set change=1& goto :oe_edition
|
||||
|
@ -452,7 +461,12 @@ goto :oe_goback
|
|||
|
||||
cls
|
||||
if not defined terminal mode 76, 25
|
||||
title Change Office Edition %masver%
|
||||
if %change%==1 (
|
||||
title Change all editions %masver%
|
||||
) else (
|
||||
title Add edition %masver%
|
||||
)
|
||||
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
|
@ -508,13 +522,23 @@ goto :oe_goback
|
|||
set inpt=
|
||||
set counter=0
|
||||
set verified=0
|
||||
set _notfound=
|
||||
set targetedition=
|
||||
|
||||
%line%
|
||||
echo:
|
||||
call :dk_color %Gray% "Installed Office editions: %_oIds%"
|
||||
call :dk_color %Gray% "You can select one of the following Office Editions."
|
||||
if %winbuild% LSS 10240 echo Unsupported products such as 2019/2021/2024 are excluded from this list.
|
||||
if %winbuild% LSS 10240 (
|
||||
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%
|
||||
echo:
|
||||
|
||||
|
@ -544,6 +568,8 @@ if %verified%==0 goto :oe_editionchange
|
|||
|
||||
:: Set app exclusions
|
||||
|
||||
:oe_excludeappspre
|
||||
|
||||
cls
|
||||
set suites=
|
||||
echo %list% | find /i "Suites" %nul1% && (
|
||||
|
@ -615,7 +641,7 @@ echo:
|
|||
call :dk_color %_Green% "Choose a menu option using your keyboard:"
|
||||
choice /C:AENOPJRVWLDT10 /N
|
||||
set _el=!errorlevel!
|
||||
if !_el!==14 goto :oe_editionchangepre
|
||||
if !_el!==14 goto :oemenu
|
||||
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!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
|
||||
|
@ -635,18 +661,18 @@ goto :oe_excludeapps
|
|||
|
||||
set excludelist=
|
||||
for %%# in (
|
||||
Access
|
||||
Excel
|
||||
OneNote
|
||||
Outlook
|
||||
PowerPoint
|
||||
Project
|
||||
Publisher
|
||||
Visio
|
||||
Word
|
||||
Lync
|
||||
OneDrive
|
||||
Teams
|
||||
access
|
||||
excel
|
||||
onenote
|
||||
outlook
|
||||
powerpoint
|
||||
project
|
||||
publisher
|
||||
visio
|
||||
word
|
||||
lync
|
||||
onedrive
|
||||
teams
|
||||
) do (
|
||||
if /i "!%%#_st!"=="Off" if defined excludelist (set excludelist=!excludelist!,%%#) else (set excludelist=,%%#)
|
||||
)
|
||||
|
@ -717,7 +743,7 @@ goto :oe_goback
|
|||
:: 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
|
||||
|
||||
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 (
|
||||
set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
|
||||
|
@ -744,10 +770,71 @@ 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
|
||||
|
||||
:oe_removeedition
|
||||
|
||||
title Remove Office editions %masver%
|
||||
|
||||
call :ch_getinfo
|
||||
|
||||
cls
|
||||
|
@ -829,6 +916,7 @@ goto :oe_goback
|
|||
|
||||
:oe_changeupdchnl
|
||||
|
||||
title Change Office update channel %masver%
|
||||
call :ch_getinfo
|
||||
|
||||
cls
|
||||
|
@ -884,10 +972,12 @@ for %%# in (
|
|||
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
|
||||
set supported=
|
||||
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc19 echo %%B | findstr /i "LTSC\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc21 echo %%B | findstr /i "LTSC2021\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if defined ltsc24 echo %%B | findstr /i "LTSC2024\>" %nul% || set supported=)
|
||||
if %winbuild% GEQ 10240 (if not defined ltscfound echo %%B | findstr /i "LTSC" %nul% && set supported=)
|
||||
if %winbuild% GEQ 10240 (
|
||||
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported=
|
||||
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported=
|
||||
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported=
|
||||
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported=
|
||||
)
|
||||
if defined supported (
|
||||
set /a counter+=1
|
||||
if !counter! LSS 10 (
|
||||
|
@ -974,7 +1064,11 @@ call :oe_tempcleanup
|
|||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -1057,13 +1151,15 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
|
|||
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
|
||||
)
|
||||
|
||||
echo %_AudienceData% | findstr /i "LTSC\>" %nul% && set ltsc19=LTSC
|
||||
set "audidata4=%_AudienceData:~-4%"
|
||||
|
||||
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 %_AudienceData% | findstr /i "LTSC2021\>" %nul% && set ltsc21=LTSC2021
|
||||
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021
|
||||
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
|
||||
|
||||
echo %_AudienceData% | findstr /i "LTSC2024\>" %nul% && set ltsc24=LTSC2024
|
||||
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024
|
||||
:: LTSC 2024 build is not fixed yet
|
||||
|
||||
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
|
||||
|
@ -1223,12 +1319,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -1238,6 +1337,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -1280,7 +1380,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
|
@ -1320,7 +1420,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -36,26 +36,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -108,6 +110,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
|
@ -173,7 +177,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -221,6 +226,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -346,15 +352,17 @@ goto dk_done
|
|||
|
||||
:: Check Windows Edition and branch
|
||||
|
||||
set osedition=0
|
||||
set dismedition=
|
||||
set osedition=
|
||||
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 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 not defined osedition %chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||
|
||||
if %osedition%==0 (
|
||||
if not defined osedition (
|
||||
%eline%
|
||||
echo Failed to detect OS edition, aborting...
|
||||
echo:
|
||||
|
@ -365,12 +373,9 @@ 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"
|
||||
if /i not "%osedition%"=="%regedition%" (
|
||||
set "showeditionerror=call :dk_color %_Yellow% "Mismatch found [WMI-%osedition%] [Reg-%regedition%].""
|
||||
set "showeditionerror=call :dk_color %_Yellow% "[%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=
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildBranch %nul6%') do set "branch=%%b"
|
||||
|
||||
|
@ -605,7 +610,7 @@ goto dk_done
|
|||
cls
|
||||
if not defined terminal (
|
||||
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;}"
|
||||
%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%
|
||||
)
|
||||
|
||||
call :ced_rebootflag
|
||||
|
@ -642,7 +647,7 @@ goto dk_done
|
|||
cls
|
||||
if not defined terminal (
|
||||
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;}"
|
||||
%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%
|
||||
)
|
||||
|
||||
set key=
|
||||
|
@ -783,12 +788,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -798,6 +806,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
@ -867,7 +876,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||
)
|
||||
|
||||
echo:
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 20)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
|
@ -987,7 +996,11 @@ echo:
|
|||
if %_unattended%==1 timeout /t 2 & exit /b
|
||||
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -1267,11 +1280,15 @@ if (!$Dism::_DismSetEdition($Session, "$TargetEdition", "$Key", 0, 0, 0)) {
|
|||
:: Separator = _
|
||||
|
||||
:: For Windows 10/11 editions, HWID key is listed where ever possible, in Server versions, KMS key is listed where ever possible.
|
||||
:: Only RS3 and older version Generic keys are stored here, later ones are extracted from the pkeyhelper.dll itself
|
||||
:: 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
|
||||
|
||||
:changeeditiondata
|
||||
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
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=)
|
||||
|
||||
set h=
|
||||
|
@ -1289,8 +1306,12 @@ YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core
|
|||
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro
|
||||
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education
|
||||
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
|
||||
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
|
||||
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH
|
||||
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage
|
||||
|
@ -1302,6 +1323,10 @@ GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN
|
|||
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG
|
||||
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN
|
||||
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
|
||||
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN
|
||||
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -103,6 +105,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
|
@ -167,7 +171,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -215,6 +220,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -701,7 +707,11 @@ echo ______________________________________________________________
|
|||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to Open Troubleshoot Page " %Gray% " Press [0] to Ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -729,12 +739,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -744,6 +757,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set masver=2.7
|
||||
@set masver=2.8
|
||||
@echo off
|
||||
|
||||
|
||||
|
@ -31,26 +31,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="r1" set r1=1
|
||||
if /i "%%#"=="r2" set r2=1
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
|
@ -103,6 +105,8 @@ set _unattended=0
|
|||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
|
@ -168,7 +172,8 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||
echo:
|
||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||
echo Failed to run Powershell command but Powershell is working.
|
||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
||||
echo:
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
|
@ -216,6 +221,7 @@ if defined terminal (
|
|||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
)
|
||||
|
||||
if defined ps32onArm goto :skipQE
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
|
@ -461,7 +467,7 @@ goto :at_back
|
|||
cls
|
||||
if not defined terminal (
|
||||
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;}"
|
||||
%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%
|
||||
)
|
||||
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^)
|
||||
|
||||
|
@ -593,7 +599,7 @@ echo [Successful]
|
|||
|
||||
echo:
|
||||
echo Restarting wlidsvc ^& LicenseManager services...
|
||||
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
||||
for %%# in (wlidsvc LicenseManager) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
|
@ -784,14 +790,6 @@ echo:
|
|||
call :dk_color %Blue% "Repairing Office licenses..."
|
||||
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 %%A in (msi14 msi15 msi16 c2r14 c2r15 c2r16) do (set %%A_%%#=&set %%Arepair%%#=)
|
||||
)
|
||||
|
@ -809,10 +807,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 %_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" & 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" & 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" & 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" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.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" & call :getc2rrepair c2r15repair86 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 %_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 %_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)
|
||||
|
||||
set uwp16=
|
||||
if %winbuild% GEQ 10240 (
|
||||
|
@ -873,11 +871,8 @@ pause %nul1%
|
|||
|
||||
if defined uwp16 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 16.0 UWP...
|
||||
echo You need to use the Reset option in Windows Settings instead.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 16.0 UWP...
|
||||
echo:
|
||||
start ms-settings:appsfeatures
|
||||
)
|
||||
|
||||
set c2r14=
|
||||
|
@ -886,11 +881,8 @@ if defined c2r14_86 set c2r14=1
|
|||
|
||||
if defined c2r14 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 14.0 C2R...
|
||||
echo You need to use the Repair option in Windows Settings for it.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 14.0 C2R...
|
||||
echo:
|
||||
start appwiz.cpl
|
||||
)
|
||||
|
||||
if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
|
||||
|
@ -913,6 +905,15 @@ echo:
|
|||
call :dk_color %Green% "Finished"
|
||||
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
|
||||
|
||||
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
|
||||
|
@ -1077,7 +1078,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%
|
||||
cmd /c exit /b %errorlevel%
|
||||
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440" %nul1%
|
||||
echo "0x%=ExitCode%" | findstr /i "0x800410 0x800440 0x80131501" %nul1%
|
||||
if %errorlevel% EQU 0 set error=1
|
||||
exit /b
|
||||
|
||||
|
@ -1138,6 +1139,8 @@ exit /b
|
|||
set permerror=
|
||||
if not exist "%tokenstore%\" set "permerror=Error Found In Token Folder"
|
||||
|
||||
if defined ps32onArm exit /b
|
||||
|
||||
for %%# in (
|
||||
"%tokenstore%+FullControl"
|
||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||
|
@ -1381,7 +1384,11 @@ $key.SetAccessControl($acl)
|
|||
|
||||
echo:
|
||||
if defined fixes (
|
||||
call :dk_color2 %Blue% "Press [1] to open Troubleshoot page " %Gray% " Press [0] to ignore"
|
||||
call :dk_color %White% " "
|
||||
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||
call :dk_color %White% " "
|
||||
echo:
|
||||
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
@ -1429,12 +1436,15 @@ set _NCS=1
|
|||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
|
@ -1444,6 +1454,7 @@ set "Red="Red" "white""
|
|||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
|
|
68
README.md
68
README.md
|
@ -2,13 +2,7 @@
|
|||
|
||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||
|
||||
<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>
|
||||
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
|
@ -21,42 +15,76 @@
|
|||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
or (deprecated, will be retired on Dec 31 2024, use above instead)
|
||||
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
|
||||
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
|
||||
```
|
||||
3. You will see the activation options. Choose [1] HWID for Windows activation. Choose [2] Ohook for Office activation.
|
||||
4. That's all.
|
||||
- The URL `get.activated.win` might be blocked by some DNS services because it is a new domain.
|
||||
|
||||
</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)
|
||||
|
||||
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)
|
||||
<details>
|
||||
<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
|
||||
3. In the extracted folder, find the folder named `All-In-One-Version`
|
||||
4. Run the file named `MAS_AIO.cmd`
|
||||
5. You will see the activation options, follow the on-screen instructions.
|
||||
6. That's all.
|
||||
|
||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
|
||||
</details>
|
||||
|
||||
</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.7
|
||||
Release date: 6-Sep-2024
|
||||
Latest Version: 2.8
|
||||
Release date: 9-Nov-2024
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||
### 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>
|
||||
|
|
Loading…
Reference in a new issue