mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-03-17 13:33:35 +00:00
Compare commits
68 Commits
445a74ccea
...
2.8
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
07ad5a208d | |||
b80a502086 | |||
104d0b0dda | |||
db218720f3 | |||
b8504cc21e | |||
2e6bfa94c2 | |||
a1244dcb3b | |||
06695612a8 | |||
323c6808af | |||
841d856a29 | |||
52d4c52dba | |||
c75cd29b9f | |||
b1b5299c47 | |||
652092e985 | |||
b06c83622a | |||
ce669809bf | |||
0afb09cbd1 | |||
5d8a463475 | |||
7044f37b44 | |||
08443039aa | |||
fd8b81411c | |||
213bc50b49 | |||
00e81be52f | |||
2443e1e471 | |||
ec31fef9b9 | |||
84f5516632 | |||
f9f386a896 | |||
8e3b4135f5 | |||
bacb32f4a1 | |||
86c86c179a | |||
35e044ddc8 |
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
# MAS export-ignore
|
||||
# LICENSE export-ignore
|
||||
# README.md export-ignore
|
||||
MAS export-ignore
|
||||
LICENSE export-ignore
|
||||
README.md export-ignore
|
||||
.gitattributes export-ignore
|
||||
|
1
LICENSE
1
LICENSE
@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
|
10505
MAS/All-In-One-Version-KL/MAS_AIO.cmd
Normal file
10505
MAS/All-In-One-Version-KL/MAS_AIO.cmd
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@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
|
||||
)
|
||||
@ -1203,7 +1210,7 @@ if defined serv_e (
|
||||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=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,32 +1363,41 @@ 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"
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
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
|
||||
)
|
||||
|
||||
@ -1419,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"
|
||||
@ -1444,7 +1471,8 @@ 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
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -1452,7 +1480,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
:: 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"
|
||||
@ -1586,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.6
|
||||
@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)
|
||||
|
||||
@ -329,7 +335,7 @@ echo:
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
echo ____________________________________________________________
|
||||
echo: ______________________________________________________
|
||||
echo:
|
||||
echo [1] KMS38 Activation
|
||||
echo ____________________________________________
|
||||
@ -337,7 +343,7 @@ echo:
|
||||
echo [2] Remove KM38 Protection
|
||||
echo:
|
||||
echo [0] %_exitmsg%
|
||||
echo ____________________________________________________________
|
||||
echo: ______________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]"
|
||||
choice /C:120 /N
|
||||
@ -444,8 +450,19 @@ if not exist "!_work!\clipup.exe" (
|
||||
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
|
||||
echo The file is required for KMS38 activation.
|
||||
echo Check the below page for instructions on how to activate it.
|
||||
set fixes=%fixes% %mas%kms38
|
||||
echo %mas%kms38
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%kms38"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
:: Check file signature
|
||||
|
||||
if defined a_cor (
|
||||
%psc% "if (-not (Get-AuthenticodeSignature -FilePath '!_work!\clipup.exe').IsOSBinary) {Exit 3}" %nul%
|
||||
if !errorlevel!==3 (
|
||||
%eline%
|
||||
echo Valid digital signature not found in clipup.exe file.
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@ -505,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
|
||||
)
|
||||
@ -640,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]
|
||||
@ -649,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...]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -849,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""
|
||||
@ -864,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""
|
||||
@ -1056,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
|
||||
@ -1107,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)
|
||||
@ -1206,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]"
|
||||
@ -1241,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
|
||||
|
||||
::========================================================================================================================================
|
||||
@ -1332,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
|
||||
)
|
||||
@ -1346,7 +1375,7 @@ if defined serv_e (
|
||||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=1
|
||||
)
|
||||
)
|
||||
@ -1362,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"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -1403,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
|
||||
|
||||
@ -1446,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]"
|
||||
@ -1488,32 +1528,41 @@ 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"
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
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
|
||||
)
|
||||
|
||||
@ -1562,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"
|
||||
@ -1587,7 +1636,8 @@ 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
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -1595,7 +1645,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
:: 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"
|
||||
@ -1729,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 %%#))
|
||||
)
|
||||
@ -1812,36 +1866,6 @@ a99cc1f0-7719-4306-9645-294102fbff95_FDNH6-VW9RW-BXPJ7-4XTYG-23%f%9TB_168_Server
|
||||
3dbf341b-5f6c-4fa7-b936-699dce9e263f_VP34G-4NPPG-79JTQ-864T4-R3%f%MQX_168_ServerAzureCor_RS1
|
||||
c2e946d1-cfa2-4523-8c87-30bc696ee584_XGN3F-F394H-FD2MY-PP6FD-8M%f%CRC_407_ServerTurbine_Ge
|
||||
19b5e0fb-4431-46bc-bac1-2f1873e4ae73_NTBV8-9K7Q8-V27C6-M2BTV-KH%f%MXV_407_ServerTurbine_RS5
|
||||
:: Old Preview editions from build 14393 - Generated keys
|
||||
43f2ab05-7c87-4d56-b27c-44d0f9a3dabd_JDTNC-PP77T-T9H2W-G4J2J-VH%f%7MW___4_Enterprise
|
||||
d3872724-5c08-4b1b-91f2-fc9eafed4990_3NMDC-G7C3W-68RGP-CQK9H-B7%f%QK9___7_ServerStandard
|
||||
ba947c44-d19d-4786-b6ae-22770bc94c54_T8N4T-C6P4F-W48KM-CYJT9-KP%f%69Y___8_ServerDatacenter
|
||||
e5676f13-9b66-4a1f-8b0c-43490e236202_RN84D-7HCWY-FTCBK-J3GHK-RM%f%YVT__17_ServerWeb
|
||||
6ae51eeb-c268-4a21-9aae-df74c38b586d_RN3QB-GT6D7-YB3VH-F3RPB-3G%f%P42__27_EnterpriseN
|
||||
ff808201-fec6-4fd4-ae16-abbddade5706_CC6JP-VN67C-8KCJ4-4V48V-HX%f%M9B__48_Professional
|
||||
34260150-69ac-49a3-8a0d-4a403ab55763_TNYKV-X79V3-CPD6X-Y2MRW-D9%f%M9H__49_ProfessionalN
|
||||
9cc2564c-292e-4d8a-b9f9-1f5007d9409a_82CNJ-W82TW-BY23W-BVJ6W-W4%f%2Y2__86_EmbeddedIndustryA
|
||||
c35a9336-fb02-48db-8f4d-245c17f03667_NXTJV-CRQYQ-W77JR-GG84R-HQ%f%VHX__89_EmbeddedIndustry
|
||||
4daf1e3e-6be9-4848-8f5a-a18a0d2895e1_7MNJY-B88MV-WQKVP-BQ6DK-6C%f%M4G__91_EmbeddedIndustryE
|
||||
b554b49f-4d57-4f08-955e-87886f514d49_4QC36-NW3YH-D2Y9D-RJPC7-VV%f%BDF__97_CoreARM
|
||||
4dfd543d-caa6-4f69-a95f-5ddfe2b89567_KG3N2-VRJ6F-P36TD-6MMCF-PP%f%QX7__98_CoreN
|
||||
5fe40dd6-cf1f-4cf2-8729-92121ac2e997_XFNM6-P9FYP-MRF6P-MM6V2-27%f%KDP__99_CoreCountrySpecific
|
||||
2cc171ef-db48-4adc-af09-7c574b37f139_N47PH-2Y8Q8-DGMMV-3PGD8-WB%f%6Q2_100_CoreSingleLanguage
|
||||
903663f7-d2ab-49c9-8942-14aa9e0a9c72_VWCNX-7FKBD-FHJYG-XBR4B-88%f%GQH_101_Core
|
||||
cc17e18a-fa93-43d6-9179-72950a1e931a_FDF9N-KGHKC-R9G6Y-W2TGC-9Q%f%CCB_103_ProfessionalWMC
|
||||
c436def1-0dcc-4849-9a59-8b6142eb70f3_2FNVD-CPYC6-WXD8M-T64BF-84%f%3GJ_111_CoreConnected
|
||||
fd5ae385-f5cf-4b53-b1fa-1af6fff7c0d8_HJN63-7Q4G4-VDW7X-TRMW8-GV%f%H3Q_112_ProfessionalStudent
|
||||
86f72c8d-8363-4188-b574-1a53cb374711_JGRP6-TNJWX-KQWHJ-6D3FJ-RX%f%73B_113_CoreConnectedN
|
||||
687f6358-6a21-453a-a712-3b3b57123827_3K4DY-NVP2W-H8DGV-42K3B-2P%f%PK9_114_ProfessionalStudentN
|
||||
5b120df4-ea3f-4e82-b0c0-6568f719730e_2N382-D6PKK-QTX4D-2JJYK-M9%f%73H_115_CoreConnectedSingleLanguage
|
||||
a8651bfb-7fe0-40df-b156-87337ecd5acc_RPM6J-N62DM-DC6XH-2JXMG-23%f%66R_116_CoreConnectedCountrySpecific
|
||||
5b2add49-b8f4-42e0-a77c-adad4efeeeb1_NT3V6-XMBK7-Q66MF-VMKR4-FC%f%26C_119_PPIPro
|
||||
af43f7f0-3b1e-4266-a123-1fdb53f4323b_BNJR8-P8QHP-VQ4QY-MVPQP-8X%f%C37_121_Education
|
||||
075aca1f-05d7-42e5-a3ce-e349e7be7078_RFNBP-FDD7Q-6FHYQ-9M9Y7-MB%f%JH3_122_EducationN
|
||||
2cf5af84-abab-4ff0-83f8-f040fb2576eb_NVYRQ-D2F32-6HGXW-DKGWM-R6%f%Y8H_125_EnterpriseS
|
||||
11a37f09-fb7f-4002-bd84-f3ae71d11e90_NMBY8-V3CV7-BX6K6-2922Y-43%f%MCH_126_EnterpriseSN
|
||||
aa234c15-ee34-4e5f-adb5-73afafb77143_DNJYG-CM8W6-4W3TX-VCK66-FV%f%WCC_127_ProfessionalS
|
||||
9f6a1bc9-5278-4991-88c9-7301c87a75ea_XB9DG-NPJ72-XRH69-7DF3Q-G8%f%3R4_128_ProfessionalSN
|
||||
) do (
|
||||
for /f "tokens=1-5 delims=_" %%A in ("%%#") do if %osSKU%==%%C (
|
||||
if %1==key if not defined key echo "!allapps!" | find /i "%%A" %nul1% && set key=%%B
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set masver=2.6
|
||||
@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 (
|
||||
|
||||
@ -742,9 +756,9 @@ call :dk_color %Red% "Failed to uninstall Ohook activation."
|
||||
call :oh_checkapps
|
||||
if defined checknames (
|
||||
call :dk_color %Blue% "Close [!checknames!] and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, reboot your machine using the restart option and try again."
|
||||
) else (
|
||||
call :dk_color %Blue% "Restart your system and try again."
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
)
|
||||
) else (
|
||||
call :dk_color %Green% "Successfully uninstalled Ohook activation."
|
||||
@ -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
|
||||
|
||||
@ -932,9 +947,9 @@ echo:
|
||||
call :oh_checkapps
|
||||
if defined checknames (
|
||||
call :dk_color %Blue% "Close [!checknames!] and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, then restart your system and try again."
|
||||
call :dk_color %Blue% "If it is still not fixed, reboot your machine using the restart option and try again."
|
||||
) else (
|
||||
if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Restart your system and try again."
|
||||
if /i not "%ierror%"=="Copy" call :dk_color %Blue% "Reboot your machine using the restart option and try again."
|
||||
if /i "%ierror%"=="Copy" call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||
)
|
||||
echo:
|
||||
@ -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% "Restart your system 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% "Restart your system 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
|
||||
)
|
||||
@ -1655,7 +1706,7 @@ if defined serv_e (
|
||||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=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,32 +1859,41 @@ 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"
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
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
|
||||
)
|
||||
|
||||
@ -1871,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"
|
||||
@ -1896,7 +1967,8 @@ 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
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -1904,7 +1976,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
:: 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"
|
||||
@ -2038,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 %%#))
|
||||
)
|
||||
@ -2113,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.6
|
||||
@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% "Restart your system 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% "Restart your system 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
|
||||
)
|
||||
@ -2704,7 +2807,7 @@ if defined serv_e (
|
||||
set error=1
|
||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||
call :dk_color %Blue% "Restart your system to fix this error."
|
||||
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||
set showfix=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,32 +2960,41 @@ 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"
|
||||
)
|
||||
|
||||
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||
)
|
||||
if defined _sppint (
|
||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
||||
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||
set showfix=1
|
||||
) || (
|
||||
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
|
||||
)
|
||||
|
||||
@ -2920,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"
|
||||
@ -2945,7 +3068,8 @@ 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
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||
)
|
||||
)
|
||||
|
||||
@ -2953,7 +3077,7 @@ call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
||||
:: 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"
|
||||
@ -3087,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 %%#))
|
||||
)
|
||||
@ -3355,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
|
||||
@ -3371,80 +3498,6 @@ a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__17_Server
|
||||
cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX__18_ServerHPC
|
||||
a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__29_ServerWebCore
|
||||
f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K__56_ServerEmbeddedSolution
|
||||
:: Old Preview editions - Generated keys
|
||||
43f2ab05-7c87-4d56-b27c-44d0f9a3dabd_JDTNC-PP77T-T9H2W-G4J2J-VH%f%7MW___4_Enterprise
|
||||
cde952c7-2f96-4d9d-8f2b-2d349f64fc51_VHF9H-NXBBB-63VJD-4V8GJ-2R%f%YK8___4_Enterprise
|
||||
2a4403df-877f-4046-8271-db6fb6ec54c8_N896F-VG44B-HF8HC-XW23F-MW%f%8YB___4_Enterprise
|
||||
d3872724-5c08-4b1b-91f2-fc9eafed4990_3NMDC-G7C3W-68RGP-CQK9H-B7%f%QK9___7_ServerStandard
|
||||
ba947c44-d19d-4786-b6ae-22770bc94c54_T8N4T-C6P4F-W48KM-CYJT9-KP%f%69Y___8_ServerDatacenter
|
||||
8a409d61-30fe-4903-bdbc-1fb28603ba3a_NBBBB-BBBBB-BBBBB-BPTW9-H4%f%83R__10_ServerEnterprise
|
||||
e5676f13-9b66-4a1f-8b0c-43490e236202_RN84D-7HCWY-FTCBK-J3GHK-RM%f%YVT__17_ServerWeb
|
||||
2412bea9-b6e0-441e-8dc2-a13720b42de9_2FNVD-CPYC6-WXD8M-VJKXF-GX%f%TCB__18_ServerHPC
|
||||
6ae51eeb-c268-4a21-9aae-df74c38b586d_RN3QB-GT6D7-YB3VH-F3RPB-3G%f%P42__27_EnterpriseN
|
||||
c23947f3-3f2e-401f-a38c-f38fe0ecb0bd_NKX82-GPWWM-C2KPY-VG78C-FF%f%9R9__27_EnterpriseN
|
||||
ff808201-fec6-4fd4-ae16-abbddade5706_CC6JP-VN67C-8KCJ4-4V48V-HX%f%M9B__48_Professional
|
||||
a4383e6b-dada-423d-a43d-f25678429676_Q8MK8-DNHMX-2XWHV-X66TM-CD%f%G33__48_Professional
|
||||
34260150-69ac-49a3-8a0d-4a403ab55763_TNYKV-X79V3-CPD6X-Y2MRW-D9%f%M9H__49_ProfessionalN
|
||||
64192251-81b0-4898-ac63-913cc3edf919_9CYB3-NFMRW-YFDG6-XRQFD-J4%f%YPJ__49_ProfessionalN
|
||||
2b9c337f-7a1d-4271-90a3-c6855a2b8a1c_992NC-RYK89-M9XBG-4DCB3-GF%f%XVK__74_Prerelease
|
||||
bfa6b683-56be-47b8-a22e-461b27b9cf11_2WFGX-YXN3B-BT46K-4DPYX-T8%f%W2J__76_ServerMultiPointStandard
|
||||
bc20fb5b-4097-484f-84d2-55b18dac95eb_CQN7Q-KH97X-TH9G4-JRGWM-R6%f%T86__77_ServerMultiPointPremium
|
||||
631ead72-a8ab-4df8-bbdf-372029989bdd_N92MW-K723D-FCBCQ-CGPPQ-3M%f%9VR__81_PrereleaseARM
|
||||
9cc2564c-292e-4d8a-b9f9-1f5007d9409a_82CNJ-W82TW-BY23W-BVJ6W-W4%f%2Y2__86_EmbeddedIndustryA
|
||||
c35a9336-fb02-48db-8f4d-245c17f03667_NXTJV-CRQYQ-W77JR-GG84R-HQ%f%VHX__89_EmbeddedIndustry
|
||||
4daf1e3e-6be9-4848-8f5a-a18a0d2895e1_7MNJY-B88MV-WQKVP-BQ6DK-6C%f%M4G__91_EmbeddedIndustryE
|
||||
c8cca3ca-bea8-4f6f-87e0-4d050ce8f0a9_RNPX3-4GPFM-2DHXB-8WD8P-4R%f%DQX__91_EmbeddedIndustryE
|
||||
5ca3e488-dbae-4fae-8282-a98fbcd21126_HM9NW-WY98Q-XDF7H-3QV6B-X4%f%QFF__91_EmbeddedIndustryE
|
||||
b554b49f-4d57-4f08-955e-87886f514d49_4QC36-NW3YH-D2Y9D-RJPC7-VV%f%BDF__97_CoreARM
|
||||
3a9a9414-24bf-4836-866d-ba13a298efb0_4K89N-FMV8W-B3F9T-HKF64-DJ%f%X27__97_CoreARM
|
||||
4dfd543d-caa6-4f69-a95f-5ddfe2b89567_KG3N2-VRJ6F-P36TD-6MMCF-PP%f%QX7__98_CoreN
|
||||
c6e3410d-e48d-41eb-8ca9-848397f46d02_3TGHP-NHXHM-2PMXX-8KR9M-G2%f%782__98_CoreN
|
||||
5fe40dd6-cf1f-4cf2-8729-92121ac2e997_XFNM6-P9FYP-MRF6P-MM6V2-27%f%KDP__99_CoreCountrySpecific
|
||||
c7a8a09a-571c-4ea8-babc-0cbe4d48a89d_H76BG-QBNM2-QRWJY-67W73-BG%f%7CQ__99_CoreCountrySpecific
|
||||
2cc171ef-db48-4adc-af09-7c574b37f139_N47PH-2Y8Q8-DGMMV-3PGD8-WB%f%6Q2_100_CoreSingleLanguage
|
||||
b148c3f4-6248-4d2f-8c6d-31cce7ae95c3_N9722-BV9H6-WTJTT-FPB93-97%f%3PR_100_CoreSingleLanguage
|
||||
903663f7-d2ab-49c9-8942-14aa9e0a9c72_VWCNX-7FKBD-FHJYG-XBR4B-88%f%GQH_101_Core
|
||||
6496e59d-89dc-49eb-a353-09ceb9404845_HRNH7-WFBYW-BV7M2-XCT6H-X7%f%3PT_101_Core
|
||||
cc17e18a-fa93-43d6-9179-72950a1e931a_FDF9N-KGHKC-R9G6Y-W2TGC-9Q%f%CCB_103_ProfessionalWMC
|
||||
cf59a07b-1a2a-4be0-bfe0-423b5823e663_FDF9N-KGHKC-R9G6Y-W2TGC-9P%f%787_103_ProfessionalWMC
|
||||
827a0032-dced-4609-ab6e-16b9d8a40280_CC92N-X2Y7W-H4H32-QHV2X-3R%f%TT9_111_CoreConnected
|
||||
c436def1-0dcc-4849-9a59-8b6142eb70f3_2FNVD-CPYC6-WXD8M-T64BF-84%f%3GJ_111_CoreConnected
|
||||
49066601-00dc-4d2c-83a8-4343a7b990d1_CF9DD-6CNW2-BJWJQ-CVCFX-Y7%f%WMR_112_ProfessionalStudent
|
||||
fd5ae385-f5cf-4b53-b1fa-1af6fff7c0d8_HJN63-7Q4G4-VDW7X-TRMW8-GV%f%H3Q_112_ProfessionalStudent
|
||||
f18bbe32-16dc-48d4-a27b-5f3966f82513_KJ3DB-VNXVJ-GJG94-RX4RF-K4%f%TVG_113_CoreConnectedN
|
||||
86f72c8d-8363-4188-b574-1a53cb374711_JGRP6-TNJWX-KQWHJ-6D3FJ-RX%f%73B_113_CoreConnectedN
|
||||
bd64ebf7-d5ec-44c5-ba00-6813441c8c87_4K89N-FMV8W-B3F9T-HKF64-DJ%f%34M_114_ProfessionalStudentN
|
||||
687f6358-6a21-453a-a712-3b3b57123827_3K4DY-NVP2W-H8DGV-42K3B-2P%f%PK9_114_ProfessionalStudentN
|
||||
964a60f6-1505-4ddb-af03-6a9ce6997d3b_NKX82-GPWWM-C2KPY-T4PKC-7C%f%FYJ_115_CoreConnectedSingleLanguage
|
||||
5b120df4-ea3f-4e82-b0c0-6568f719730e_2N382-D6PKK-QTX4D-2JJYK-M9%f%73H_115_CoreConnectedSingleLanguage
|
||||
b5fe5eaa-14cc-4075-84ae-57c0206d1133_BJMNR-F3WG7-H8W83-27XXK-P3%f%8MC_116_CoreConnectedCountrySpecific
|
||||
a8651bfb-7fe0-40df-b156-87337ecd5acc_RPM6J-N62DM-DC6XH-2JXMG-23%f%66R_116_CoreConnectedCountrySpecific
|
||||
5b2add49-b8f4-42e0-a77c-adad4efeeeb1_NT3V6-XMBK7-Q66MF-VMKR4-FC%f%26C_119_PPIPro
|
||||
af43f7f0-3b1e-4266-a123-1fdb53f4323b_BNJR8-P8QHP-VQ4QY-MVPQP-8X%f%C37_121_Education
|
||||
e8ced63e-420d-4ab6-8723-aaf165efb5eb_QBQ3Q-2NC74-MKH8F-DTQ34-QG%f%M3G_121_Education
|
||||
075aca1f-05d7-42e5-a3ce-e349e7be7078_RFNBP-FDD7Q-6FHYQ-9M9Y7-MB%f%JH3_122_EducationN
|
||||
3885bca5-11c1-4d4e-9395-df38f7f09a0e_7MFGN-34DMC-J8FCR-P4DKH-KH%f%J8F_122_EducationN
|
||||
b995b62c-eae2-40aa-afb9-111889a84ef4_DW99Y-H7NT6-6B29D-8JQ8F-R3%f%K6T_124_ServerHI
|
||||
2cf5af84-abab-4ff0-83f8-f040fb2576eb_NVYRQ-D2F32-6HGXW-DKGWM-R6%f%Y8H_125_EnterpriseS
|
||||
75d003b0-dc66-42c0-b3a1-308a3f35741a_FQ32Q-MN6JD-FPVJ9-HJD4W-PK%f%CWY_125_EnterpriseS
|
||||
11a37f09-fb7f-4002-bd84-f3ae71d11e90_NMBY8-V3CV7-BX6K6-2922Y-43%f%MCH_126_EnterpriseSN
|
||||
4e4d5504-e7b1-419c-913d-3c80c15294fc_KGR4C-FWN4D-33RTK-XB6Q8-K2%f%FPT_126_EnterpriseSN
|
||||
b15187db-11c6-4f13-91ca-8121cebf5b88_JBDKF-6NCD6-49K3G-2TV79-BK%f%PB4_127_ProfessionalS
|
||||
aa234c15-ee34-4e5f-adb5-73afafb77143_DNJYG-CM8W6-4W3TX-VCK66-FV%f%WCC_127_ProfessionalS
|
||||
6cdbc9fb-63f5-431b-a5c0-c6f19ae26a9b_2NWVW-QGF4T-9CPMB-WYDQ9-7X%f%PB8_128_ProfessionalSN
|
||||
9f6a1bc9-5278-4991-88c9-7301c87a75ea_XB9DG-NPJ72-XRH69-7DF3Q-G8%f%3R4_128_ProfessionalSN
|
||||
:: Missing keys for old preview editions
|
||||
:: 38fbe2ac-465a-4ef7-b9d8-72044f2792b6 4 Enterprise
|
||||
:: ea77973e-4930-4fa1-a899-02dfaeada1db 4 Enterprise
|
||||
:: 92374131-ed4c-4d1b-846a-32f43c3eb90d 7 ServerStandard
|
||||
:: cc64c548-1867-4777-a1cc-0022691bc2a0 8 ServerDatacenter
|
||||
:: 9dce1f29-bb10-4be0-8027-35b953dd46d5 10 ServerEnterprise
|
||||
:: bf9eda2f-74cc-4ba3-8967-cde30f18c230 15 ServerEnterpriseIA64
|
||||
:: 4f4cfa6c-76d8-49f5-9c41-0a57f8af1bbc 17 ServerWeb
|
||||
:: 8372b47d-5221-41d8-88d0-3f924e50623e 18 ServerHPC
|
||||
:: e4ecef68-4372-4740-98e8-6c157cd301c2 27 EnterpriseN
|
||||
:: 957ec1e8-97cd-42a8-a091-01a30cf779da 48 Professional
|
||||
:: 0ff4e536-a746-4018-b107-e81dd0b6d33a 49 ProfessionalN
|
||||
::========================================================================================================================================
|
||||
:: Office 2010
|
||||
8ce7e872-188c-4b98-9d90-f8f90b7aad02_V7Y44-9T38C-R2VJK-666HK-T7%f%DDX__14_AccessVL
|
||||
@ -3549,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.6
|
||||
@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.6
|
||||
@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=
|
||||
@ -700,7 +705,7 @@ for /f %%a in ('%psc% "(Get-Date).ToString('yyyyMMdd-HHmmssfff')"') do set _time
|
||||
sc query TrustedInstaller | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Failed to stop the TrustedInstaller service.
|
||||
echo Restart your system and try again.
|
||||
echo Reboot your machine using the restart option and try again.
|
||||
set preperror=1
|
||||
exit /b
|
||||
)
|
||||
@ -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 %%#))
|
||||
)
|
||||
@ -1004,7 +1017,7 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: https://github.com/Gamers-Against-Weed/Set-WindowsCbsEdition
|
||||
:: https://github.com/asdcorp/Set-WindowsCbsEdition
|
||||
|
||||
:cbsxml:[
|
||||
param (
|
||||
@ -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.6
|
||||
@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.6
|
||||
@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^)
|
||||
|
||||
@ -474,7 +480,8 @@ echo - This option helps in troubleshooting activation issues.
|
||||
echo:
|
||||
echo - This option will:
|
||||
echo - Deactivate Windows and Office, you may need to reactivate.
|
||||
echo If Windows is activated with motherboard / OEM / Digital license then Windows will activate itself again.
|
||||
echo If Windows is activated with motherboard / OEM / Digital license
|
||||
echo then Windows will activate itself again.
|
||||
echo:
|
||||
echo - Clear ClipSVC, SPP and OSPP licenses.
|
||||
echo - Fix permissions of SPP tokens folder and registries.
|
||||
@ -546,7 +553,7 @@ echo Deleting a Volatile ^& Protected Registry Key...
|
||||
echo [%RegKey%]
|
||||
reg query "%RegKey%" %nul% && (
|
||||
call :dk_color %Red% "[Failed]"
|
||||
echo Restart your system, that will delete this registry key automatically.
|
||||
echo Reboot your machine using the restart option, that will delete this registry key automatically.
|
||||
) || (
|
||||
echo [Successful]
|
||||
)
|
||||
@ -592,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")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@ -647,6 +654,15 @@ echo:
|
||||
echo Stopping sppsvc service...
|
||||
%psc% Stop-Service sppsvc -force %nul%
|
||||
|
||||
set w=
|
||||
set _sppint=
|
||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1))
|
||||
if defined _sppint (
|
||||
echo:
|
||||
echo Removing SPP IFEO registry keys...
|
||||
for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9200 (
|
||||
REM Fix issues caused by Update KB971033 in Windows 7
|
||||
REM https://support.microsoft.com/help/4487266
|
||||
@ -774,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%%#=)
|
||||
)
|
||||
@ -799,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 (
|
||||
@ -863,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=
|
||||
@ -876,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%"
|
||||
@ -903,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"
|
||||
@ -1067,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
|
||||
|
||||
@ -1128,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"
|
||||
@ -1371,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 %%#))
|
||||
)
|
||||
@ -1419,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""
|
||||
@ -1434,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""
|
||||
|
84
README.md
84
README.md
@ -2,61 +2,89 @@
|
||||
|
||||
<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>
|
||||
|
||||
## Download / How to use it?
|
||||
|
||||
### Method 1 - PowerShell (Recommended)
|
||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||
|
||||
- Right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
|
||||
- Copy and paste the code below and press enter
|
||||
1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal.
|
||||
2. Copy and paste the code below and press enter
|
||||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
or (deprecated, will be retired on Aug 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
|
||||
```
|
||||
- You will see the activation options. Follow the on-screen instructions.
|
||||
- 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)
|
||||
|
||||
### Method 2 - Traditional
|
||||
<details>
|
||||
<summary>Click here for info</summary>
|
||||
|
||||
- Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Bitbucket](https://bitbucket.org/WindowsAddict/microsoft-activation-scripts)
|
||||
- Right-click on the downloaded zip file and extract
|
||||
- In the extracted folder, find the folder named `All-In-One-Version`
|
||||
- Run the file named `MAS_AIO-CRC32_XXXXXXXX.cmd`
|
||||
- You will see the activation options, follow the on-screen instructions.
|
||||
- That's all.
|
||||
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.6
|
||||
Release date: 20-Apr-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>
|
||||
|
Reference in New Issue
Block a user