mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-09-03 19:32:33 +02:00
Compare commits
202 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d5e382e763 | ||
|
793550725a | ||
|
3917497c82 | ||
|
28c2264d89 | ||
|
a51ae62332 | ||
|
ffcb641f17 | ||
|
53a2747338 | ||
|
3a99ea4eeb | ||
|
e6eaeaa682 | ||
|
e2c52b4ac8 | ||
|
31c47b9538 | ||
|
904e96d748 | ||
|
5e2cc4f5cf | ||
|
c619a2c381 | ||
|
9c09432b01 | ||
|
e476ac66a4 | ||
|
dba7213a91 | ||
|
0f38fa3cef | ||
|
2dd41cc2c5 | ||
|
d78e262f5b | ||
|
fd1e146753 | ||
|
bc781ad079 | ||
|
43cceb366e | ||
|
39bcefa02b | ||
|
2b37400aa8 | ||
|
1fb65d4f9c | ||
|
10b6e8b6dc | ||
|
cb36c19f01 | ||
|
4aa811dd5e | ||
|
5d37a99966 | ||
|
64a726202c | ||
|
c3e70173e4 | ||
|
c817ae8bd9 | ||
|
ef411e14ca | ||
|
5aa7d4f3de | ||
|
409c4f71ad | ||
|
d7a6994363 | ||
|
5ad6226f37 | ||
|
ae9f4e34ff | ||
|
67abcd0c89 | ||
|
faf3bf3a08 | ||
|
482600c890 | ||
|
dc90e1ff0f | ||
|
f969378f6b | ||
|
c89bebdee8 | ||
|
be7d101df5 | ||
|
55b6fce50a | ||
|
6566bb53c1 | ||
|
2e44a4a77b | ||
|
9073a35fe0 | ||
|
9f244ddc17 | ||
|
8ed0c6874b | ||
|
a99acbb025 | ||
|
be867f6616 | ||
|
fc80735dac | ||
|
69c469a997 | ||
|
6e74d49721 | ||
|
ae93f547f5 | ||
|
830755f6b6 | ||
|
a149fc5f20 | ||
|
b75ba72bc5 | ||
|
206c31ece5 | ||
|
133d3b9720 | ||
|
fc2348bf53 | ||
|
966fbd14f6 | ||
|
691e6088d5 | ||
|
74b7c74218 | ||
|
4c53e6231b | ||
|
2d00dfa704 | ||
|
bf28e4fbdd | ||
|
2a2352428e | ||
|
be9215b728 | ||
|
93cf3864f5 | ||
|
d47a750bad | ||
|
817bfe84de | ||
|
2b40259b33 | ||
|
a514a99d0e | ||
|
2a806c2e0c | ||
|
b3aaff5110 | ||
|
bcc4214e8a | ||
|
9e80556df5 | ||
|
b24bb9bde1 | ||
|
dfebdefeba | ||
|
1bdee1ce6f | ||
|
4e702068be | ||
|
6945236590 | ||
|
5872b7df53 | ||
|
b8ad749bac | ||
|
5090cde0a0 | ||
|
af18bd773c | ||
|
52ba9f138f | ||
|
98ef9db3ce | ||
|
172fd7b1c5 | ||
|
372eb73a02 | ||
|
a1614e1283 | ||
|
e8bf344f74 | ||
|
70162c4130 | ||
|
294837dfe0 | ||
|
f5a0a63165 | ||
|
0d61475468 | ||
|
c316b42e5c | ||
|
3b739d7e2b | ||
|
8673fbbfda | ||
|
60dd549a49 | ||
|
1e3c0aaedf | ||
|
fe001e6c39 | ||
|
c4f33e96c4 | ||
|
313f240448 | ||
|
69f1a206fb | ||
|
ab0cd24f89 | ||
|
55afa30fcd | ||
|
5e7e42a446 | ||
|
a9eda8f572 | ||
|
a5bcfdd3e6 | ||
|
8d67d62c15 | ||
|
6adb247334 | ||
|
6c8732dd06 | ||
|
9765e7d05f | ||
|
60c99742ce | ||
|
8f3f392517 | ||
|
af69d79c5c | ||
|
63045afc70 | ||
|
19c6612a47 | ||
|
9e6f386819 | ||
|
b5ba36c033 | ||
|
d10b6d691e | ||
|
de812acdc5 | ||
|
75c34cbf50 | ||
|
0d533338a1 | ||
|
411f387705 | ||
|
be44b2d887 | ||
|
0c88f6bc2c | ||
|
d31e4ab0cb | ||
|
9fd5a661ab | ||
|
b732e2c8d7 | ||
|
8e2677b1f9 | ||
|
f2e40bf88e | ||
|
a4f9b219ab | ||
|
7262a44ba2 | ||
|
37ec96504a | ||
|
051b4f673f | ||
|
3ef6d7292e | ||
|
0d9ffd2052 | ||
|
9f00df5aee | ||
|
d6aa8b97d1 | ||
|
c00b076a86 | ||
|
8fff2ccb9c | ||
|
5638898eaf | ||
|
22ed7a7a07 | ||
|
f1ddb83df0 | ||
|
4dd0215ccc | ||
|
ec259dfbd7 | ||
|
bbdc9bdfd8 | ||
|
7d036f57fd | ||
|
ab90514b0a | ||
|
25abc1f457 | ||
|
873c4bc4d8 | ||
|
0b402d9afe | ||
|
5141866f0a | ||
|
f0618824a4 | ||
|
03cc88193d | ||
|
897a9db808 | ||
|
9bbd02cc91 | ||
|
d1dca45710 | ||
|
5e71252993 | ||
|
1db017f1f1 | ||
|
d06ba7fc4c | ||
|
99954a9056 | ||
|
fcb710a48a | ||
|
0cbaa141c3 | ||
|
9d1964ceda | ||
|
0477cf13e1 | ||
|
9b568d4b4e | ||
|
1c9fe0815e | ||
|
a5dd99ac00 | ||
|
1849dd3075 | ||
|
8fe0b24945 | ||
|
7c69c471c5 | ||
|
f32cb934dc | ||
|
7a6e63a462 | ||
|
d76b2ea57e | ||
|
1f0e04519a | ||
|
d059952ecd | ||
|
6efb5d50fe | ||
|
b2831795a4 | ||
|
4e8ebecd3d | ||
|
d929cd8fa0 | ||
|
d384c5f2f7 | ||
|
643d4f077f | ||
|
db26b75b64 | ||
|
07ad5a208d | ||
|
b80a502086 | ||
|
104d0b0dda | ||
|
db218720f3 | ||
|
b8504cc21e | ||
|
2e6bfa94c2 | ||
|
a1244dcb3b | ||
|
06695612a8 | ||
|
323c6808af | ||
|
841d856a29 | ||
|
52d4c52dba | ||
|
c75cd29b9f |
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1,4 +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
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
Activation Type Supported Product Activation Period
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
HWID - Windows 10-11 - Permanent
|
||||
Ohook - Office - Permanent
|
||||
KMS38 - Windows 10-11-Server - Till the Year 2038
|
||||
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
|
||||
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
For more details, use the respective docs section here https://massgrave.dev/
|
9780
MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
9780
MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
File diff suppressed because it is too large
Load Diff
14
MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
14
MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
Activation Type Supported Product Activation Period
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
HWID - Windows 10-11 - Permanent
|
||||
Ohook - Office - Permanent
|
||||
TSforge - Windows / ESU / Office - Permanent
|
||||
KMS38 - Windows 10-11-Server - Till the Year 2038
|
||||
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
|
||||
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
Check the below link for more details:
|
||||
https://massgrave.dev/chart
|
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
@set masver=2.7
|
||||
@set masver=3.5
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@@ -36,26 +36,29 @@ 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
|
||||
if /i "%%#"=="-qedit" (set re1=1&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
|
||||
)
|
||||
|
||||
@@ -63,6 +66,8 @@ exit /b
|
||||
|
||||
set "blank="
|
||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||
|
||||
:: Check if Null service is working, it's important for the batch script
|
||||
|
||||
@@ -72,7 +77,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@@ -87,7 +92,7 @@ echo:
|
||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@@ -108,6 +113,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
|
||||
@@ -124,10 +131,30 @@ set "line=echo _________________________________________________________________
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
%nceline%
|
||||
%eline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@@ -163,32 +190,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
|
||||
|
||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||
%eline%
|
||||
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:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
) || (
|
||||
echo PowerShell is not working. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell"
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@@ -201,6 +202,86 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||
echo Test 1 - %tstresult%
|
||||
echo Test 2 - !tstresult2!
|
||||
echo:
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check for Mal-ware that may cause issues with Powershell
|
||||
|
||||
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||
echo "%%f"
|
||||
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||
)
|
||||
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@@ -211,33 +292,35 @@ set terminal=
|
||||
|
||||
:: Check if script is running in Terminal app
|
||||
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
|
||||
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
|
||||
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
|
||||
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
|
||||
|
||||
if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
set lines=0
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||
|
||||
set resetQE=1
|
||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||
|
||||
if defined terminal (
|
||||
set "launchcmd=start conhost.exe %psc%"
|
||||
) else (
|
||||
set "launchcmd=%psc%"
|
||||
start conhost.exe "!_batf!" %_args% -qedit
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
) else if %resetQE% EQU 1 (
|
||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Disable QuickEdit in current session
|
||||
|
||||
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
|
||||
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
|
||||
|
||||
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
|
||||
:skipQE
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -246,9 +329,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@@ -264,7 +357,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -304,8 +397,11 @@ if not exist %SysPath%\%%# (
|
||||
%eline%
|
||||
echo [%SysPath%\%%#] file is missing, aborting...
|
||||
echo:
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
|
||||
call :dk_color %Blue% "After that, restart system and try activation again."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
@@ -330,15 +426,14 @@ if defined UBR (set "fullbuild=%%G.!UBR!") else (set "fullbuild=%%G.%%H")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check Activation ID
|
||||
:: Check Activation IDs
|
||||
|
||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined apps (
|
||||
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
if not defined allapps (
|
||||
%eline%
|
||||
echo Either key is not insalled or script failed to get installed key's activation ID. Aborting...
|
||||
echo Failed to find activation IDs. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@@ -346,31 +441,29 @@ 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 "Current 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:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
|
||||
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"
|
||||
|
||||
@@ -385,10 +478,10 @@ set _ntarget=
|
||||
set _wtarget=
|
||||
|
||||
if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a "))
|
||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||
if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a "))
|
||||
|
||||
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||
call :ced_edilist
|
||||
if %winbuild% GEQ 17063 call :ced_edilist
|
||||
if /i "%osedition:~0,4%"=="Core" set _pro=Professional
|
||||
if /i "%osedition%"=="CoreN" set _pro=ProfessionalN
|
||||
set "_dtarget= %_dtarget% !_wtarget! !_pro! "
|
||||
@@ -501,7 +594,7 @@ set _dismapi=0
|
||||
|
||||
:: Check if DISM API or slmgr.vbs is required for edition upgrade
|
||||
|
||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\" (
|
||||
if not exist "%SysPath%\spp\tokens\skus\%targetedition%\%targetedition%*.xrm-ms" (
|
||||
echo %_wtarget% | find /i " %targetedition% " || (
|
||||
set _dismapi=1
|
||||
)
|
||||
@@ -524,7 +617,7 @@ echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@@ -579,7 +672,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition."
|
||||
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -591,7 +684,7 @@ echo:
|
||||
call :ced_prep
|
||||
if defined preperror goto dk_done
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%"
|
||||
call :ced_postprep
|
||||
)
|
||||
%line%
|
||||
@@ -605,7 +698,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
|
||||
@@ -629,7 +722,7 @@ call :ced_prep
|
||||
if defined preperror goto dk_done
|
||||
|
||||
if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%"
|
||||
call :ced_postprep
|
||||
%line%
|
||||
|
||||
@@ -642,7 +735,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=
|
||||
@@ -660,7 +753,7 @@ echo [%targetedition% ^| %winbuild%]
|
||||
echo Failed to get product key from pkeyhelper.dll.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@@ -736,14 +829,14 @@ echo:
|
||||
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
|
||||
echo:
|
||||
set fixes=%fixes% %mas%change_edition_issues
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%change_edition_issues"
|
||||
exit /b
|
||||
|
||||
:compresslog
|
||||
|
||||
:: https://stackoverflow.com/a/46268232
|
||||
|
||||
set "ddf="%SystemRoot%\Temp\ddf""
|
||||
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||
%nul% del /q /f %ddf%
|
||||
echo/.New Cabinet>%ddf%
|
||||
echo/.set Cabinet=ON>>%ddf%
|
||||
@@ -775,20 +868,29 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
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 +900,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""
|
||||
@@ -825,14 +928,14 @@ if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call RefreshLicenseStatus
|
||||
if %_wmic% EQU 0 %psc% "$null=(([WMICLASS]'%sps%').GetInstances()).RefreshLicenseStatus()" %nul%
|
||||
exit /b
|
||||
|
||||
:: Get installed products Activation IDs
|
||||
:: Get all products Activation IDs
|
||||
|
||||
:dk_actid
|
||||
:dk_actids
|
||||
|
||||
set apps=
|
||||
if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1' and PartialProductKey is not null) 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'' AND PartialProductKey IS NOT NULL').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')"
|
||||
%chkapp% do (if defined apps (call set "apps=!apps! %%a") else (call set "apps=%%a"))
|
||||
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"))
|
||||
exit /b
|
||||
|
||||
:: Get Edition list
|
||||
@@ -848,6 +951,7 @@ exit /b
|
||||
|
||||
:dk_ckeckwmic
|
||||
|
||||
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||
set _wmic=0
|
||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||
@@ -858,16 +962,16 @@ exit /b
|
||||
|
||||
:dk_sppissue
|
||||
|
||||
sc start sppsvc %nul%
|
||||
sc start %_slser% %nul%
|
||||
set spperror=%errorlevel%
|
||||
|
||||
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
|
||||
%eline%
|
||||
echo sc start sppsvc [Error Code: %spperror%]
|
||||
echo sc start %_slser% [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 '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||
exit /b
|
||||
|
||||
:: Common lines used in PowerShell reflection code
|
||||
@@ -965,8 +1069,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@@ -974,8 +1080,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
@@ -987,9 +1095,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% "Follow ALL the ABOVE blue lines. "
|
||||
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 %%#))
|
||||
if !errorlevel!==2 exit /b
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
||||
if defined terminal (
|
||||
@@ -1267,54 +1377,66 @@ 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=
|
||||
set w=
|
||||
for %%# in (
|
||||
XGVPP-NMH47-7TTHJ-W3FW7-8HV%h%2C__OEM:NONSLP_Enterprise
|
||||
D6RD9-D4N8T-RT9QX-YW6YT-FCW%h%WJ______Retail_Starter
|
||||
3V6Q6-NQXCX-V8YXR-9QCYV-QPF%h%CT__Volume:MAK_EnterpriseN
|
||||
3NFXW-2T27M-2BDW6-4GHRV-68X%h%RX______Retail_StarterN
|
||||
VK7JG-NPHTM-C97JM-9MPGT-3V6%h%6T______Retail_Professional
|
||||
2B87N-8KFHP-DKV6R-Y2C8J-PKC%h%KT______Retail_ProfessionalN
|
||||
4CPRK-NM3K3-X6XXQ-RXX86-WXC%h%HW______Retail_CoreN
|
||||
N2434-X9D7W-8PF6X-8DV9T-8TY%h%MD______Retail_CoreCountrySpecific
|
||||
BT79Q-G7N6G-PGBYW-4YWX6-6F4%h%BT______Retail_CoreSingleLanguage
|
||||
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
|
||||
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1
|
||||
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH
|
||||
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
|
||||
HNGCC-Y38KG-QVK8D-WMWRK-X86%h%VK______Retail_ProfessionalCountrySpecific
|
||||
DXG7C-N36C4-C4HTG-X4T3X-2YV%h%77______Retail_ProfessionalWorkstation
|
||||
WYPNQ-8C467-V2W6J-TX4WX-WT2%h%RQ______Retail_ProfessionalWorkstationN
|
||||
8PTT6-RNW4C-6V7J2-C2D3X-MHB%h%PB______Retail_ProfessionalEducation
|
||||
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
|
||||
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
|
||||
WC2BQ-8NRM3-FDDYY-2BFGV-KHK%h%QY_Volume:GVLK_ServerStandard%Cor%_RS1
|
||||
CB7KF-BWN84-R7R2Y-793K2-8XD%h%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1
|
||||
JCKRF-N37P4-C2D82-9YXRT-4M6%h%3B_Volume:GVLK_ServerSolution_RS1
|
||||
QN4C6-GBJD2-FB422-GHWJK-GJG%h%2R_Volume:GVLK_ServerCloudStorage_RS1
|
||||
VP34G-4NPPG-79JTQ-864T4-R3M%h%QX_Volume:GVLK_ServerAzureCor_RS1
|
||||
9JQNQ-V8HQ6-PKB8H-GGHRY-R62%h%H6______Retail_ServerAzureNano_RS1
|
||||
VN8D3-PR82H-DB6BJ-J9P4M-92F%h%6J______Retail_ServerStorageStandard_RS1
|
||||
48TQX-NVK3R-D8QR3-GTHHM-8FH%h%XC______Retail_ServerStorageWorkgroup_RS1
|
||||
2HXDN-KRXHB-GPYC7-YCKFJ-7FV%h%DG_Volume:GVLK_ServerDatacenterACor_RS3
|
||||
PTXN8-JFHJM-4WC78-MPCBR-9W4%h%KR_Volume:GVLK_ServerStandardACor_RS3
|
||||
XGVPP-NMH47-7TTHJ-W3FW7-8HV%w%2C__OEM:NONSLP_Enterprise
|
||||
D6RD9-D4N8T-RT9QX-YW6YT-FCW%w%WJ______Retail_Starter
|
||||
3V6Q6-NQXCX-V8YXR-9QCYV-QPF%w%CT__Volume:MAK_EnterpriseN
|
||||
3NFXW-2T27M-2BDW6-4GHRV-68X%w%RX______Retail_StarterN
|
||||
VK7JG-NPHTM-C97JM-9MPGT-3V6%w%6T______Retail_Professional
|
||||
2B87N-8KFHP-DKV6R-Y2C8J-PKC%w%KT______Retail_ProfessionalN
|
||||
4CPRK-NM3K3-X6XXQ-RXX86-WXC%w%HW______Retail_CoreN
|
||||
N2434-X9D7W-8PF6X-8DV9T-8TY%w%MD______Retail_CoreCountrySpecific
|
||||
BT79Q-G7N6G-PGBYW-4YWX6-6F4%w%BT______Retail_CoreSingleLanguage
|
||||
YTMG3-N6DKC-DKB77-7M9GH-8HV%w%X7______Retail_Core
|
||||
XKCNC-J26Q9-KFHD2-FKTHY-KD7%w%2Y__OEM:NONSLP_PPIPro
|
||||
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%w%BY______Retail_Education
|
||||
84NGF-MHBT6-FXBX8-QWJK7-DRR%w%8H______Retail_EducationN
|
||||
KCNVH-YKWX8-GJJB9-H9FDT-6F7%w%W2__Volume:MAK_EnterpriseS_VB
|
||||
43TBQ-NH92J-XKTM7-KT3KK-P39%w%PB__OEM:NONSLP_EnterpriseS_RS5
|
||||
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%w%WX__OEM:NONSLP_EnterpriseS_RS1
|
||||
FWN7H-PF93Q-4GGP8-M8RF3-MDW%w%WW__OEM:NONSLP_EnterpriseS_TH
|
||||
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%w%PT__Volume:MAK_EnterpriseSN_VB
|
||||
M33WV-NHY3C-R7FPM-BQGPT-239%w%PG__Volume:MAK_EnterpriseSN_RS5
|
||||
2DBW3-N2PJG-MVHW3-G7TDK-9HK%w%R4__Volume:MAK_EnterpriseSN_RS1
|
||||
NTX6B-BRYC2-K6786-F6MVQ-M7V%w%2X__Volume:MAK_EnterpriseSN_TH
|
||||
G3KNM-CHG6T-R36X3-9QDG6-8M8%w%K9______Retail_ProfessionalSingleLanguage
|
||||
HNGCC-Y38KG-QVK8D-WMWRK-X86%w%VK______Retail_ProfessionalCountrySpecific
|
||||
DXG7C-N36C4-C4HTG-X4T3X-2YV%w%77______Retail_ProfessionalWorkstation
|
||||
WYPNQ-8C467-V2W6J-TX4WX-WT2%w%RQ______Retail_ProfessionalWorkstationN
|
||||
8PTT6-RNW4C-6V7J2-C2D3X-MHB%w%PB______Retail_ProfessionalEducation
|
||||
GJTYN-HDMQY-FRR76-HVGC7-QPF%w%8P______Retail_ProfessionalEducationN
|
||||
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%w%JC__Volume:MAK_EnterpriseG
|
||||
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%w%Y8__Volume:MAK_EnterpriseGN
|
||||
NJCF7-PW8QT-3324D-688JX-2YV%w%66______Retail_ServerRdsh
|
||||
XQQYW-NFFMW-XJPBH-K8732-CKF%w%FD______OEM:DM_IoTEnterprise
|
||||
QPM6N-7J2WJ-P88HH-P3YRH-YY7%w%4H__OEM:NONSLP_IoTEnterpriseS
|
||||
K9VKN-3BGWV-Y624W-MCRMQ-BHD%w%CD______Retail_CloudEditionN
|
||||
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%w%4W______Retail_CloudEdition
|
||||
V3WVW-N2PV2-CGWC3-34QGF-VMJ%w%2C______Retail_Cloud
|
||||
NH9J3-68WK7-6FB93-4K3DF-DJ4%w%F6______Retail_CloudN
|
||||
2HN6V-HGTM8-6C97C-RK67V-JQP%w%FD______Retail_CloudE
|
||||
WC2BQ-8NRM3-FDDYY-2BFGV-KHK%w%QY_Volume:GVLK_ServerStandard%Cor%_RS1
|
||||
CB7KF-BWN84-R7R2Y-793K2-8XD%w%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1
|
||||
JCKRF-N37P4-C2D82-9YXRT-4M6%w%3B_Volume:GVLK_ServerSolution_RS1
|
||||
QN4C6-GBJD2-FB422-GHWJK-GJG%w%2R_Volume:GVLK_ServerCloudStorage_RS1
|
||||
VP34G-4NPPG-79JTQ-864T4-R3M%w%QX_Volume:GVLK_ServerAzureCor_RS1
|
||||
9JQNQ-V8HQ6-PKB8H-GGHRY-R62%w%H6______Retail_ServerAzureNano_RS1
|
||||
VN8D3-PR82H-DB6BJ-J9P4M-92F%w%6J______Retail_ServerStorageStandard_RS1
|
||||
48TQX-NVK3R-D8QR3-GTHHM-8FH%w%XC______Retail_ServerStorageWorkgroup_RS1
|
||||
2HXDN-KRXHB-GPYC7-YCKFJ-7FV%w%DG_Volume:GVLK_ServerDatacenterACor_RS3
|
||||
PTXN8-JFHJM-4WC78-MPCBR-9W4%w%KR_Volume:GVLK_ServerStandardACor_RS3
|
||||
) do (
|
||||
for /f "tokens=1-4 delims=_" %%A in ("%%#") do if /i %targetedition%==%%C (
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
@set masver=2.7
|
||||
@set masver=3.5
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@@ -31,26 +31,29 @@ 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
|
||||
if /i "%%#"=="-qedit" (set re1=1&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
|
||||
)
|
||||
|
||||
@@ -58,6 +61,8 @@ exit /b
|
||||
|
||||
set "blank="
|
||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||
|
||||
:: Check if Null service is working, it's important for the batch script
|
||||
|
||||
@@ -67,7 +72,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@@ -82,7 +87,7 @@ echo:
|
||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@@ -103,6 +108,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
|
||||
@@ -118,10 +125,47 @@ call :dk_setvar
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto done2
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents.
|
||||
if %winbuild% EQU 6000 (
|
||||
echo:
|
||||
echo Windows Vista RTM is not supported because Powershell cannot be installed.
|
||||
echo Upgrade to Windows Vista SP1 or SP2.
|
||||
)
|
||||
goto done2
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
|
||||
%nceline%
|
||||
if not exist %ps% (
|
||||
echo PowerShell is not installed in your system.
|
||||
)
|
||||
echo Install PowerShell 2.0 using the following URL.
|
||||
echo:
|
||||
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
|
||||
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
|
||||
goto done2
|
||||
)
|
||||
|
||||
@@ -157,32 +201,6 @@ goto done2
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
|
||||
|
||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||
%eline%
|
||||
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:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
) || (
|
||||
echo PowerShell is not working. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell"
|
||||
)
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@@ -195,6 +213,86 @@ goto done2
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||
echo Test 1 - %tstresult%
|
||||
echo Test 2 - !tstresult2!
|
||||
echo:
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check for Mal-ware that may cause issues with Powershell
|
||||
|
||||
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||
echo "%%f"
|
||||
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||
)
|
||||
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@@ -205,33 +303,35 @@ set terminal=
|
||||
|
||||
:: Check if script is running in Terminal app
|
||||
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
|
||||
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
|
||||
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
|
||||
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
|
||||
|
||||
if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
set lines=0
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||
|
||||
set resetQE=1
|
||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||
|
||||
if defined terminal (
|
||||
set "launchcmd=start conhost.exe %psc%"
|
||||
) else (
|
||||
set "launchcmd=%psc%"
|
||||
start conhost.exe "!_batf!" %_args% -qedit
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
) else if %resetQE% EQU 1 (
|
||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Disable QuickEdit in current session
|
||||
|
||||
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
|
||||
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
|
||||
|
||||
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
|
||||
:skipQE
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -240,9 +340,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@@ -258,7 +368,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -299,6 +409,7 @@ set HWID_Activation.cmd=Activators\HWID_Activation.cmd
|
||||
set KMS38_Activation.cmd=Activators\KMS38_Activation.cmd
|
||||
set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd
|
||||
set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
|
||||
set TSforge_Activation.cmd=Activators\TSforge_Activation.cmd
|
||||
pushd "!_work!"
|
||||
|
||||
set _nofile=
|
||||
@@ -307,6 +418,7 @@ for %%# in (
|
||||
%KMS38_Activation.cmd%
|
||||
%Online_KMS_Activation.cmd%
|
||||
%Ohook_Activation_AIO.cmd%
|
||||
%TSforge_Activation.cmd%
|
||||
) do (
|
||||
if not exist "%%#" set _nofile=1
|
||||
)
|
||||
@@ -332,36 +444,34 @@ echo:
|
||||
echo:
|
||||
echo:
|
||||
echo: Extract $OEM$ folder on the desktop
|
||||
echo: ________________________________________________________
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
echo: [1] HWID
|
||||
echo: [2] Ohook
|
||||
echo: [3] KMS38
|
||||
echo: [4] Online KMS
|
||||
echo: [1] HWID [Windows]
|
||||
echo: [2] Ohook [Office]
|
||||
echo: [3] TSforge [Windows / ESU / Office]
|
||||
echo: [4] KMS38 [Windows]
|
||||
echo: [5] Online KMS [Windows / Office]
|
||||
echo:
|
||||
echo: [5] HWID ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [6] HWID ^(Windows^) ^+ Online KMS ^(Office^)
|
||||
echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
|
||||
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
|
||||
echo: [6] HWID [Windows] ^+ Ohook [Office]
|
||||
echo: [7] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
|
||||
echo: [8] TSforge [Windows] ^+ Online KMS [Office]
|
||||
echo:
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ________________________________________________________
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
|
||||
choice /C:123456789R0 /N
|
||||
choice /C:12345678R0 /N
|
||||
set _erl=%errorlevel%
|
||||
|
||||
if %_erl%==11 exit /b
|
||||
if %_erl%==10 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==9 goto:kms_ohook
|
||||
if %_erl%==8 goto:kms38_kms
|
||||
if %_erl%==7 goto:kms38_ohook
|
||||
if %_erl%==6 goto:hwid_kms
|
||||
if %_erl%==5 goto:hwid_ohook
|
||||
if %_erl%==4 goto:kms
|
||||
if %_erl%==3 goto:kms38
|
||||
if %_erl%==10 exit /b
|
||||
if %_erl%==9 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==8 goto:tsforge_kms
|
||||
if %_erl%==7 goto:hwid_ohook_tsforge
|
||||
if %_erl%==6 goto:hwid_ohook
|
||||
if %_erl%==5 goto:kms
|
||||
if %_erl%==4 goto:kms38
|
||||
if %_erl%==3 goto:tsforge
|
||||
if %_erl%==2 goto:ohook
|
||||
if %_erl%==1 goto:hwid
|
||||
goto :Menu
|
||||
@@ -428,6 +538,36 @@ cd \
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:tsforge
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export tsforge_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=TSforge
|
||||
goto done
|
||||
|
||||
:tsforge_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-WindowsESUOffice
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:tsforge_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38
|
||||
|
||||
cls
|
||||
@@ -526,26 +666,28 @@ cd \
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:hwid_kms
|
||||
:hwid_ohook_tsforge
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export hwid_kms_setup
|
||||
call :export hwid_ohook_tsforge_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=HWID [Windows] + Online KMS [Office]
|
||||
set oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]
|
||||
goto done
|
||||
|
||||
:hwid_kms_setup:
|
||||
:hwid_ohook_tsforge_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
@@ -554,80 +696,46 @@ setlocal
|
||||
call "%~dp0HWID_Activation.cmd" /HWID
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:hwid_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export kms38_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=KMS38 [Windows] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:kms38_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0KMS38_Activation.cmd" /KMS38
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-ESU
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms38_ohook_setup:
|
||||
:hwid_ohook_tsforge_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms38_kms
|
||||
:tsforge_kms
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%KMS38_Activation.cmd%" "!_dir!\KMS38_Activation.cmd" %nul%
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export kms38_kms_setup
|
||||
call :export tsforge_kms_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\KMS38_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=KMS38 [Windows] + Online KMS [Office]
|
||||
set oem=TSforge [Windows] + Online KMS [Office]
|
||||
goto done
|
||||
|
||||
:kms38_kms_setup:
|
||||
:tsforge_kms_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0KMS38_Activation.cmd" /KMS38
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-Windows
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
@@ -636,45 +744,7 @@ endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms38_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export kms_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=Online KMS [Windows] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:kms_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-Windows
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms_ohook_setup:
|
||||
:tsforge_kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@@ -692,7 +762,7 @@ call :dk_color %Blue% "%oem%"
|
||||
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
|
||||
echo "%oem%" | find /i "38" %nul% && (
|
||||
echo:
|
||||
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
|
||||
echo To KMS38 activate Server Cor/Acor editions [No GUI Versions],
|
||||
echo Check this page %mas%oem-folder
|
||||
)
|
||||
echo ______________________________________________________________
|
||||
@@ -701,9 +771,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% "Follow ALL the ABOVE blue lines. "
|
||||
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 %%#))
|
||||
if !errorlevel!==2 exit /b
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
||||
if defined terminal (
|
||||
@@ -721,20 +793,29 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
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 +825,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""
|
||||
@@ -767,7 +849,7 @@ exit /b
|
||||
|
||||
:export
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);"
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -776,8 +858,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
@@ -785,8 +869,10 @@ exit /b
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
@set masver=2.7
|
||||
@set masver=3.5
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: mass grave[.]dev
|
||||
:: Homepage: mass<>grave<.>dev
|
||||
:: Email: mas.help@outlook.com
|
||||
::
|
||||
::============================================================================
|
||||
@@ -31,26 +31,29 @@ 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
|
||||
if /i "%%#"=="-qedit" (set re1=1&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
|
||||
)
|
||||
|
||||
@@ -58,6 +61,8 @@ exit /b
|
||||
|
||||
set "blank="
|
||||
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/"
|
||||
set "github=ht%blank%tps%blank%://github.com/massgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/massg%blank%rave/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||
|
||||
:: Check if Null service is working, it's important for the batch script
|
||||
|
||||
@@ -67,7 +72,7 @@ echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
@@ -82,7 +87,7 @@ echo:
|
||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
echo:
|
||||
echo Help - %mas%troubleshoot
|
||||
echo Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
@@ -103,6 +108,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
|
||||
@@ -119,10 +126,47 @@ set "line=______________________________________________________________________
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||
echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents.
|
||||
if %winbuild% EQU 6000 (
|
||||
echo:
|
||||
echo Windows Vista RTM is not supported because Powershell cannot be installed.
|
||||
echo Upgrade to Windows Vista SP1 or SP2.
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
|
||||
%nceline%
|
||||
if not exist %ps% (
|
||||
echo PowerShell is not installed in your system.
|
||||
)
|
||||
echo Install PowerShell 2.0 using the following URL.
|
||||
echo:
|
||||
echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
|
||||
if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
@@ -158,32 +202,6 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
|
||||
|
||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||
%eline%
|
||||
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:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||
) || (
|
||||
echo PowerShell is not working. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell"
|
||||
)
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
@@ -196,6 +214,86 @@ goto dk_done
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||
echo Test 1 - %tstresult%
|
||||
echo Test 2 - !tstresult2!
|
||||
echo:
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check for Mal-ware that may cause issues with Powershell
|
||||
|
||||
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||
echo "%%f"
|
||||
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto dk_done
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||
)
|
||||
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto dk_done
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
@@ -206,33 +304,35 @@ set terminal=
|
||||
|
||||
:: Check if script is running in Terminal app
|
||||
|
||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
|
||||
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
|
||||
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
|
||||
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
|
||||
|
||||
if defined terminal (
|
||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||
set lines=0
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||
|
||||
set resetQE=1
|
||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||
|
||||
if defined terminal (
|
||||
set "launchcmd=start conhost.exe %psc%"
|
||||
) else (
|
||||
set "launchcmd=%psc%"
|
||||
start conhost.exe "!_batf!" %_args% -qedit
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
) else if %resetQE% EQU 1 (
|
||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Disable QuickEdit in current session
|
||||
|
||||
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
|
||||
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
|
||||
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
|
||||
|
||||
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
|
||||
:skipQE
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -241,9 +341,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
@@ -259,7 +369,7 @@ echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -320,7 +430,7 @@ if %_erl%==5 goto:retokens
|
||||
if %_erl%==4 goto:fixwmi
|
||||
if %_erl%==3 goto:sfcscan
|
||||
if %_erl%==2 goto:dism_rest
|
||||
if %_erl%==1 start %mas%troubleshoot.html &goto at_menu
|
||||
if %_erl%==1 (start %selfgit% & start %github% & start %mas%troubleshoot & goto at_menu)
|
||||
goto :at_menu
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -461,10 +571,17 @@ 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^)
|
||||
|
||||
if %winbuild% EQU 6001 (
|
||||
%eline%
|
||||
echo This option is not supported on Windows Vista SP1.
|
||||
echo Upgrade to Windows Vista SP2.
|
||||
goto :at_back
|
||||
)
|
||||
|
||||
echo:
|
||||
echo %line%
|
||||
echo:
|
||||
@@ -481,7 +598,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses.
|
||||
echo - Fix permissions of SPP tokens folder and registries.
|
||||
echo - Trigger the repair option for Office.
|
||||
echo:
|
||||
call :dk_color2 %_White% " - " %Red% "Apply this option only when it is necessary."
|
||||
call :dk_color2 %_White% " - " %Blue% "Apply this option only when it is necessary."
|
||||
echo:
|
||||
echo %line%
|
||||
echo:
|
||||
@@ -593,7 +710,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")
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@@ -607,6 +724,25 @@ echo:
|
||||
call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
|
||||
echo:
|
||||
|
||||
echo Clearing KMS Cache...
|
||||
echo:
|
||||
call :_taskclear-cache
|
||||
|
||||
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
||||
echo Removing KMS38 protection...
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
|
||||
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
|
||||
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
||||
call :dk_color %Red% "Failed to remove KMS38 protection."
|
||||
) || (
|
||||
echo Successfully removed KMS38 protection.
|
||||
echo Successfully cleared KMS Cache.
|
||||
)
|
||||
) || (
|
||||
echo Successfully cleared KMS Cache.
|
||||
)
|
||||
echo:
|
||||
|
||||
call :scandat check
|
||||
|
||||
if not defined token (
|
||||
@@ -632,7 +768,7 @@ echo Checking SPP permission related issues...
|
||||
call :checkperms
|
||||
if defined permerror (
|
||||
call :dk_color %Red% "[!permerror!]"
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';iex ($f[1])" %nul%
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul%
|
||||
call :checkperms
|
||||
if defined permerror (
|
||||
call :dk_color %Red% "[!permerror!] [Failed To Fix]"
|
||||
@@ -645,21 +781,21 @@ echo [No Error Found]
|
||||
)
|
||||
|
||||
echo:
|
||||
echo Stopping sppsvc service...
|
||||
%psc% Stop-Service sppsvc -force %nul%
|
||||
echo Stopping %_slser% service...
|
||||
%psc% Stop-Service %_slser% -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))
|
||||
for %%# in (SppEx%w%tComObj.exe %_slexe%) 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%)
|
||||
for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9200 (
|
||||
if %winbuild% LSS 9200 if not defined _vis (
|
||||
REM Fix issues caused by Update KB971033 in Windows 7
|
||||
REM https://support.microsoft.com/help/4487266
|
||||
REM https://support.microsoft.com/en-us/help/4487266
|
||||
echo:
|
||||
echo Checking Update KB971033...
|
||||
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
|
||||
@@ -676,6 +812,7 @@ del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-81
|
||||
|
||||
:: Delete registry keys that are not deleted by activation scripts
|
||||
|
||||
if not defined _vis (
|
||||
echo:
|
||||
echo Cleaning some licensing-related registry keys...
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f
|
||||
@@ -683,6 +820,7 @@ echo Cleaning some licensing-related registry keys...
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "PolicyValuesArray" /f
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f
|
||||
%nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f
|
||||
)
|
||||
|
||||
echo:
|
||||
call :scandat delete
|
||||
@@ -694,10 +832,14 @@ call :dk_color %Red% "Failed to delete .dat files."
|
||||
echo:
|
||||
)
|
||||
|
||||
if defined _vis (
|
||||
%psc% Start-Service %_slser% %nul%
|
||||
)
|
||||
|
||||
echo:
|
||||
echo Reinstalling system licenses...
|
||||
%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
||||
if %errorlevel% EQU 0 (
|
||||
echo [Successful]
|
||||
) else (
|
||||
@@ -713,7 +855,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file."
|
||||
echo tokens.dat file was rebuilt successfully.
|
||||
)
|
||||
|
||||
if %winbuild% LSS 9200 (
|
||||
if %winbuild% LSS 9200 if not defined _vis (
|
||||
sc config sppuinotify start= demand
|
||||
)
|
||||
|
||||
@@ -784,14 +926,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%%#=)
|
||||
)
|
||||
@@ -802,17 +936,17 @@ set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office
|
||||
reg query %_68%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_68=Office 14.0 C2R x86/x64" & set "c2r14repair68=")
|
||||
reg query %_86%\14.0\CVH /f Click2run /k %nul% && (set "c2r14_86=Office 14.0 C2R x86" & set "c2r14repair86=")
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15)
|
||||
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%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_86=Office 14.0 MSI x86" & call :getrepairsetup msi14repair86 14)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi14_68=Office 14.0 MSI x86/x64" & call :getrepairsetup msi14repair68 14)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.dll" (set "msi15_68=Office 15.0 MSI x86/x64" & call :getrepairsetup msi15repair68 15)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*Picker.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\*Picker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16)
|
||||
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & set "c2r15repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & set "c2r15repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\integratedoffice.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & set "c2r16repair86=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & set "c2r16repair68=%systemdrive%\Program Files\Microsoft Office 15\Client%arch%\OfficeClickToRun.exe")
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2rrepair c2r16repair86 OfficeClickToRun.exe)
|
||||
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2rrepair c2r16repair68 OfficeClickToRun.exe)
|
||||
|
||||
set uwp16=
|
||||
if %winbuild% GEQ 10240 (
|
||||
@@ -873,11 +1007,8 @@ pause %nul1%
|
||||
|
||||
if defined uwp16 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 16.0 UWP...
|
||||
echo You need to use the Reset option in Windows Settings instead.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 16.0 UWP...
|
||||
echo:
|
||||
start ms-settings:appsfeatures
|
||||
)
|
||||
|
||||
set c2r14=
|
||||
@@ -886,11 +1017,8 @@ if defined c2r14_86 set c2r14=1
|
||||
|
||||
if defined c2r14 (
|
||||
echo:
|
||||
echo Note: Skipping repair for Office 14.0 C2R...
|
||||
echo You need to use the Repair option in Windows Settings for it.
|
||||
echo ________________________________________________________________
|
||||
echo Skipping repair for Office 14.0 C2R...
|
||||
echo:
|
||||
start appwiz.cpl
|
||||
)
|
||||
|
||||
if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
|
||||
@@ -913,6 +1041,15 @@ echo:
|
||||
call :dk_color %Green% "Finished"
|
||||
goto :at_back
|
||||
|
||||
:getc2rrepair
|
||||
|
||||
for %%# in (X86 X64) do (
|
||||
if exist "%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2" (
|
||||
set "%1=%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2"
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
|
||||
:getrepairsetup
|
||||
|
||||
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
|
||||
@@ -1077,7 +1214,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
|
||||
|
||||
@@ -1103,7 +1240,7 @@ goto :at_menu
|
||||
|
||||
:: https://stackoverflow.com/a/46268232
|
||||
|
||||
set "ddf="%SystemRoot%\Temp\ddf""
|
||||
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
|
||||
%nul% del /q /f %ddf%
|
||||
echo/.New Cabinet>%ddf%
|
||||
echo/.set Cabinet=ON>>%ddf%
|
||||
@@ -1138,6 +1275,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"
|
||||
@@ -1153,7 +1292,7 @@ set "permerror=Error Found In SPP Registries"
|
||||
)
|
||||
)
|
||||
|
||||
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
REM https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
||||
if not defined permerror (
|
||||
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||
@@ -1167,6 +1306,59 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Clean existing K-M-S cache from the registry
|
||||
|
||||
:_taskclear-cache
|
||||
|
||||
set w=
|
||||
for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do (
|
||||
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%
|
||||
)
|
||||
|
||||
set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
|
||||
|
||||
if %winbuild% LSS 7600 (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && (
|
||||
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
|
||||
)
|
||||
)
|
||||
if not defined SPPk (
|
||||
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
|
||||
)
|
||||
|
||||
set "slp=SoftwareLicensingProduct"
|
||||
set "ospp=OfficeSoftwareProtectionProduct"
|
||||
|
||||
set "_wApp=55c92734-d682-4d71-983e-d6ec3f16059f"
|
||||
set "_oApp=0ff1ce15-a989-479d-af46-f275c6370663"
|
||||
set "_oA14=59a52881-a989-479d-af46-f275c6370663"
|
||||
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName /reg:32
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort /reg:32
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v DisableDnsPublishing
|
||||
%nul% reg delete "HKLM\%SPPk%" /f /v DisableKeyManagementServiceHostCaching
|
||||
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
|
||||
if %winbuild% GEQ 9200 (
|
||||
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f
|
||||
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f /reg:32
|
||||
)
|
||||
if %winbuild% GEQ 9600 (
|
||||
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_wApp%" /f
|
||||
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_oApp%" /f
|
||||
)
|
||||
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServiceName
|
||||
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServicePort
|
||||
%nul% reg delete "HKLM\%OPPk%" /f /v DisableDnsPublishing
|
||||
%nul% reg delete "HKLM\%OPPk%" /f /v DisableKeyManagementServiceHostCaching
|
||||
%nul% reg delete "HKLM\%OPPk%\%_oA14%" /f
|
||||
%nul% reg delete "HKLM\%OPPk%\%_oApp%" /f
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix SPP related registry and folder permissions
|
||||
|
||||
:fixsppperms:
|
||||
@@ -1199,7 +1391,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
|
||||
}
|
||||
|
||||
# Fix perms for SPP in HKU\S-1-5-20
|
||||
# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
# https://learn.microsoft.com/en-us/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||
|
||||
if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
|
||||
exit
|
||||
@@ -1282,13 +1474,13 @@ function InstallLicenseArr($Str) {
|
||||
ForEach ($x in $a) {InstallLicenseFile "$x"}
|
||||
}
|
||||
function InstallLicenseDir($Loc) {
|
||||
dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"}
|
||||
Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName}
|
||||
}
|
||||
function ReinstallLicenses() {
|
||||
$Oem = "$env:SysPath\oem"
|
||||
$Spp = "$env:SysPath\spp\tokens"
|
||||
InstallLicenseDir "$Spp"
|
||||
If (Test-Path $Oem) {InstallLicenseDir "$Oem"}
|
||||
$Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
|
||||
foreach ($Path in $Paths) {
|
||||
if (Test-Path $Path) { InstallLicenseDir "$Path" }
|
||||
}
|
||||
}
|
||||
:xrm:
|
||||
|
||||
@@ -1302,6 +1494,7 @@ for %%# in (
|
||||
%SysPath%\spp\store\
|
||||
%SysPath%\spp\store\2.0\
|
||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
|
||||
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\
|
||||
) do (
|
||||
|
||||
if %1==check (
|
||||
@@ -1345,7 +1538,7 @@ exit /b
|
||||
|
||||
:regownstart
|
||||
|
||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regown\:.*';iex ($f[1]);"
|
||||
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));"
|
||||
exit /b
|
||||
|
||||
:: Below code takes ownership of a volatile registry key and deletes it
|
||||
@@ -1377,13 +1570,71 @@ $key.SetAccessControl($acl)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: This code runs to undo below registry key KMS38 protection
|
||||
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
|
||||
|
||||
:: This option is not used in KMS38 anymore, it's here only to remove previous versions protection.
|
||||
|
||||
:regdel:
|
||||
param (
|
||||
[switch]$protect
|
||||
)
|
||||
|
||||
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
|
||||
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
|
||||
|
||||
if($protect) {
|
||||
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
|
||||
} else {
|
||||
$ruleArgs = @("$Admin", "FullControl", "Allow")
|
||||
}
|
||||
|
||||
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
|
||||
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
|
||||
$acl = $key.GetAccessControl()
|
||||
|
||||
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
|
||||
$acl.ResetAccessRule($rule)
|
||||
$key.SetAccessControl($acl)
|
||||
:regdel:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_color
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
) else if not exist %ps% (
|
||||
echo %~3
|
||||
)
|
||||
exit /b
|
||||
|
||||
:dk_color2
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else if exist %ps% (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
) else if not exist %ps% (
|
||||
echo %~3 %~6
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_done
|
||||
|
||||
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% "Follow ALL the ABOVE blue lines. "
|
||||
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 %%#))
|
||||
if !errorlevel!==2 exit /b
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
||||
if defined terminal (
|
||||
@@ -1393,26 +1644,7 @@ choice /c 0 /n
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
pause %nul1%
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:dk_color
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[0m
|
||||
) else (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||
)
|
||||
exit /b
|
||||
|
||||
:dk_color2
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||
) else (
|
||||
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -1421,20 +1653,29 @@ exit /b
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set psc=powershell.exe
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
@@ -1444,6 +1685,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""
|
||||
|
193
README.md
193
README.md
@@ -1,62 +1,131 @@
|
||||
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
||||
|
||||
<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>
|
||||
|
||||
<hr>
|
||||
|
||||
## Download / How to use it?
|
||||
|
||||
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||
|
||||
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 Dec 31 2024, use above instead)
|
||||
```
|
||||
irm https://massgrave.dev/get | iex
|
||||
```
|
||||
3. You will see the activation options. Choose [1] HWID for Windows activation. Choose [2] Ohook for Office activation.
|
||||
4. That's all.
|
||||
|
||||
---
|
||||
|
||||
- On older Windows builds you may need to run the below command before,
|
||||
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
|
||||
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
|
||||
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
|
||||
|
||||
### Method 2 - Traditional (Windows 7 and later)
|
||||
|
||||
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Bitbucket](https://bitbucket.org/WindowsAddict/microsoft-activation-scripts) or [Codeberg](https://codeberg.org/massgravel/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)
|
||||
|
||||
</br>
|
||||
|
||||
```
|
||||
Latest Version: 2.7
|
||||
Release date: 6-Sep-2024
|
||||
```
|
||||
|
||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||
|
||||
---
|
||||
|
||||
<p align="center">Made with Love ❤️</p>
|
||||
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></p>
|
||||
|
||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||
|
||||
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
## How to Activate Windows / Office / Extended Updates (ESU)?
|
||||
|
||||
### Method 1 - PowerShell ❤️
|
||||
|
||||
1. **Open PowerShell**
|
||||
Click the **Start Menu**, type `PowerShell`, then open it.
|
||||
|
||||
2. **Copy and paste the code below, then press enter.**
|
||||
- For **Windows 8, 10, 11**: 📌
|
||||
```
|
||||
irm https://get.activated.win | iex
|
||||
```
|
||||
- For **Windows 7** and later:
|
||||
```
|
||||
iex ((New-Object Net.WebClient).DownloadString('https://get.activated.win'))
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Script not launching❓Click here for info.</summary>
|
||||
|
||||
---
|
||||
|
||||
- If the above is blocked (by ISP/DNS), try this (needs **updated Windows 10 or 11**):
|
||||
```
|
||||
iex (curl.exe -s --doh-url https://1.1.1.1/dns-query https://get.activated.win | Out-String)
|
||||
```
|
||||
- If that fails or you have an older Windows, use the below-listed Method 2.
|
||||
|
||||
---
|
||||
|
||||
</details>
|
||||
|
||||
3. The activation menu will appear. **Choose the green-highlighted options** to activate Windows or Office.
|
||||
|
||||
4. **Done!**
|
||||
|
||||
---
|
||||
|
||||
### Method 2 - Traditional (Windows Vista and later)
|
||||
|
||||
<details>
|
||||
<summary>Click here to view</summary>
|
||||
|
||||
1. Download the file using one of the links below:
|
||||
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
|
||||
or
|
||||
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
|
||||
2. Right-click on the downloaded zip file and extract it.
|
||||
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.
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
> [!TIP]
|
||||
> - Some ISPs/DNS block access to our domains. You can bypass this by enabling [DNS-over-HTTPS (DoH)](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/encrypted-dns-browsers/) in your browser.
|
||||
> - **Having trouble**❓Visit our [troubleshooting page](https://massgrave.dev/troubleshoot) or raise an issue on [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts/issues).
|
||||
|
||||
---
|
||||
|
||||
- To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
|
||||
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
||||
|
||||
---
|
||||
|
||||
> [!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.
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
Latest Version: 3.5
|
||||
Release date: 10-Aug-2025
|
||||
```
|
||||
|
||||
### [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]
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![1.4]][4]
|
||||
[![1.5]][5]
|
||||
[![1.6]][6]
|
||||
[![1.7]][7]
|
||||
|
||||
</div>
|
||||
|
||||
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
|
||||
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
|
||||
[1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
|
||||
|
||||
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
||||
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
||||
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
|
||||
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
|
||||
|
||||
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
||||
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts
|
||||
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
|
||||
[4]: https://discord.gg/j2yFsV5ZVC
|
||||
[5]: https://www.reddit.com/r/MAS_Activator
|
||||
[6]: https://bsky.app/profile/massgrave.dev
|
||||
[7]: https://twitter.com/massgravel
|
||||
|
||||
---
|
||||
|
||||
<p align="center">Made with Love ❤️</p>
|
||||
|
Reference in New Issue
Block a user