Compare commits

..

141 Commits
2.9 ... master

Author SHA1 Message Date
WindowsAddict
d5e382e763 Revert export-ignore 2025-08-11 02:48:26 +05:30
WindowsAddict
793550725a export-ignore 2025-08-11 02:36:40 +05:30
WindowsAddict
3917497c82 3.5 2025-08-11 02:29:59 +05:30
WindowsAddict
28c2264d89 Change arg to detect no relaunch to change process 2025-08-11 01:39:53 +05:30
WindowsAddict
a51ae62332 Update README, don't relaunch if unattended mode found 2025-08-10 17:22:28 +05:30
WindowsAddict
ffcb641f17 Fix a typo 2025-08-08 22:14:21 +05:30
WindowsAddict
53a2747338 Fix redirection issue on W10 ARM64 2025-08-07 17:43:26 +05:30
WindowsAddict
3a99ea4eeb Fix build version detection on XP and older 2025-08-07 02:43:05 +05:30
WindowsAddict
e6eaeaa682 Detect vnext license and show info 2025-08-07 01:50:09 +05:30
WindowsAddict
e2c52b4ac8 Some more minor changes 2025-08-04 21:30:05 +05:30
WindowsAddict
31c47b9538 Minor changes 2025-08-04 21:03:49 +05:30
WindowsAddict
904e96d748 Check .NET corruption 2025-08-04 02:05:13 +05:30
WindowsAddict
5e2cc4f5cf Update sandbox detection code 2025-08-03 04:10:11 +05:30
WindowsAddict
c619a2c381 Add a message about KMS renewal notification in 26200 2025-08-03 03:28:06 +05:30
WindowsAddict
9c09432b01 Update error message 2025-08-03 01:49:35 +05:30
WindowsAddict
e476ac66a4 Detect Windows Sandbox 2025-08-03 01:45:30 +05:30
WindowsAddict
dba7213a91 Fix a typo 2025-08-02 22:06:03 +05:30
WindowsAddict
0f38fa3cef Streamline diagnostic tests 2025-08-02 21:59:38 +05:30
WindowsAddict
2dd41cc2c5 Evade detection 2025-07-23 17:58:38 +05:30
WindowsAddict
d78e262f5b Clarify the on/off status in add/remove Office apps option 2025-07-22 05:16:41 +05:30
WindowsAddict
fd1e146753 dot-source scriptblock 2025-07-22 04:50:50 +05:30
WindowsAddict
bc781ad079 Remove KMS38 protection feature, it's not important. 2025-07-22 04:40:17 +05:30
WindowsAddict
43cceb366e Fix issues in checking expired Office products 2025-07-22 02:02:52 +05:30
WindowsAddict
39bcefa02b Improve error info 2025-07-22 00:55:14 +05:30
WindowsAddict
2b37400aa8 Detect unsupported languages for Office 2019 Perpetual VL update channel 2025-07-22 00:12:59 +05:30
WindowsAddict
1fb65d4f9c Fix an issue in add/remove apps when more than one lang is installed 2025-07-21 14:10:52 +05:30
WindowsAddict
10b6e8b6dc Show Ohook in green if O365 is installed 2025-07-18 00:27:13 +05:30
WindowsAddict
cb36c19f01 Show a tip about ESU updates 2025-07-17 23:21:08 +05:30
WindowsAddict
4aa811dd5e Update info 2025-07-17 21:40:37 +05:30
WindowsAddict
5d37a99966 Add ESU support for Core editions (Release preview 19045.6156) 2025-07-17 21:34:04 +05:30
WindowsAddict
64a726202c Update list 2025-07-12 12:18:44 +05:30
WindowsAddict
c3e70173e4 Skip changing region in top countries 2025-07-12 03:53:16 +05:30
WindowsAddict
c817ae8bd9 Add detection for Microsoft Defender for Endpoint 2025-07-02 23:46:34 +05:30
WindowsAddict
ef411e14ca Evade AV detection 2025-07-02 23:35:17 +05:30
WindowsAddict
5aa7d4f3de Revert "Evade AV detection"
This reverts commit 409c4f71ad4b069c8b57adc148c7980927e7f75c.
2025-07-02 23:12:04 +05:30
WindowsAddict
409c4f71ad Evade AV detection 2025-06-26 22:49:57 +05:30
WindowsAddict
d7a6994363 Fix a bug in detecting Terminal app 2025-06-25 02:34:34 +05:30
WindowsAddict
5ad6226f37 Revert export-ignore 2025-06-03 18:37:59 +05:30
WindowsAddict
ae9f4e34ff export-ignore 2025-06-03 18:31:39 +05:30
WindowsAddict
67abcd0c89 3.4 2025-06-03 18:25:10 +05:30
WindowsAddict
faf3bf3a08 Update KMS server list 2025-06-03 17:23:00 +05:30
WindowsAddict
482600c890 Show info related to expired Office preview products 2025-06-03 16:44:13 +05:30
WindowsAddict
dc90e1ff0f Update info message related to ZCID 2025-06-03 14:55:20 +05:30
WindowsAddict
f969378f6b Fix a bug in unattended mode in TSforge 2025-06-03 13:35:40 +05:30
WindowsAddict
c89bebdee8 Revert export-ignore 2025-06-01 21:10:50 +05:30
WindowsAddict
be7d101df5 Merge branch 'dev' 2025-06-01 20:57:31 +05:30
WindowsAddict
55b6fce50a Update readme 2025-06-01 20:46:56 +05:30
WindowsAddict
6566bb53c1 export-ignore 2025-06-01 20:31:23 +05:30
WindowsAddict
2e44a4a77b 3.3 2025-06-01 20:30:48 +05:30
WindowsAddict
9073a35fe0 Add StaticCID and KMS4k method in TSforge 2025-06-01 20:27:57 +05:30
WindowsAddict
9f244ddc17 Fix grammar 2025-05-27 22:10:02 +05:30
WindowsAddict
8ed0c6874b Suggest TSforge for Office where Windows is not supposed to get feature upgrades 2025-05-27 22:04:35 +05:30
WindowsAddict
a99acbb025 Update Powershell error detection code 2025-05-27 20:43:23 +05:30
WindowsAddict
be867f6616 Update links 2025-05-27 19:32:44 +05:30
WindowsAddict
fc80735dac Improve fix info in the script 2025-05-25 00:38:43 +05:30
WindowsAddict
69c469a997 Update old Office version detection with subscription license 2025-05-23 18:56:14 +05:30
WindowsAddict
6e74d49721 Minor fix 2025-05-23 18:20:53 +05:30
WindowsAddict
ae93f547f5 Add the option to change Office update channel to VL and from VL to retail 2025-05-23 17:54:17 +05:30
WindowsAddict
830755f6b6 Fix an issue in detecting Office preview licenses in TSforge 2025-05-18 18:11:04 +05:30
WindowsAddict
a149fc5f20 Change hash 2025-05-18 13:08:08 +05:30
WindowsAddict
b75ba72bc5 Change hash 2025-05-18 12:52:40 +05:30
WindowsAddict
206c31ece5 Open mirror pages along with massgrave.dev 2025-05-18 12:09:25 +05:30
WindowsAddict
133d3b9720 Edit the info related to Mondo conversion 2025-05-18 10:46:12 +05:30
WindowsAddict
fc2348bf53 Add some info related to O365 to Mondo conversion in TSforge 2025-05-18 03:39:29 +05:30
WindowsAddict
966fbd14f6 Don't ask to run other fixes if file infector malware is detected 2025-05-18 02:47:41 +05:30
WindowsAddict
691e6088d5 Use user temp folder or random name in Windows/Temp 2025-05-18 02:41:47 +05:30
WindowsAddict
74b7c74218 Continue to activate in case of errors 2025-05-18 01:40:41 +05:30
WindowsAddict
4c53e6231b Fix Microsoft links 2025-05-08 05:31:04 +05:30
WindowsAddict
2d00dfa704 Revert export-ignore 2025-05-06 23:10:58 +05:30
WindowsAddict
bf28e4fbdd export-ignore 2025-05-06 22:37:54 +05:30
WindowsAddict
2a2352428e 3.2 2025-05-06 22:36:13 +05:30
WindowsAddict
be9215b728 Fix goback button in change Office edition script 2025-05-06 20:01:06 +05:30
WindowsAddict
93cf3864f5 Directly go back when asked to press key to ignore opening support page 2025-05-06 19:53:15 +05:30
WindowsAddict
d47a750bad Detect Powershell 1.0 on Server 2008 and ask to install Powershell 2.0 2025-05-06 19:29:19 +05:30
WindowsAddict
817bfe84de Don't ask to run SFC scan if malware is found 2025-05-06 18:26:33 +05:30
WindowsAddict
2b40259b33 Add fixes for CAS 2025-05-06 18:09:33 +05:30
WindowsAddict
a514a99d0e Update an error message in KMS script 2025-05-06 17:47:27 +05:30
WindowsAddict
2a806c2e0c Fix ARM32 Office detection 2025-05-06 17:39:26 +05:30
WindowsAddict
b3aaff5110 Update Windows 7 ESU 4-6y info 2025-05-06 17:14:27 +05:30
WindowsAddict
bcc4214e8a Add O365AppsBasicRetail conversion in KMS script 2025-05-05 22:38:51 +05:30
WindowsAddict
9e80556df5 Add O365AppsBasicRetail support 2025-05-05 22:25:54 +05:30
WindowsAddict
b24bb9bde1 Remove () from product name 2025-05-04 17:04:06 +05:30
WindowsAddict
dfebdefeba Add Office 2010 Publisher Retail key 2025-05-04 02:21:50 +05:30
WindowsAddict
1bdee1ce6f Improve edition package detection 2025-05-04 01:03:13 +05:30
WindowsAddict
4e702068be Revert export-ignore 2025-04-29 23:06:43 +05:30
WindowsAddict
6945236590 Merge branch 'dev' 2025-04-29 22:45:01 +05:30
WindowsAddict
5872b7df53 3.1
Added Ohook support for OSPP based Office on Vista and later
2025-04-29 22:40:56 +05:30
WindowsAddict
b8ad749bac Fix issue related to URL opening in unattended mode 2025-04-21 20:22:13 +05:30
WindowsAddict
5090cde0a0 Use wmic.exe on builds below 9200 2025-04-21 18:01:09 +05:30
WindowsAddict
af18bd773c Fix a missing echo 2025-04-21 02:29:22 +05:30
WindowsAddict
52ba9f138f Ask to run DISM restore and SFC scan when system files are missing 2025-04-21 00:53:08 +05:30
WindowsAddict
98ef9db3ce Add TSforge and Online KMS support for Vista/Server2008 2025-04-20 19:35:53 +05:30
WindowsAddict
172fd7b1c5 Fix crash issue when scripts are running under a path with special characters 2025-04-17 03:11:21 +05:30
WindowsAddict
372eb73a02 Add updated TSforge code 2025-04-17 01:47:13 +05:30
WindowsAddict
a1614e1283 Convert HomeStudentARM IDs to Mondo because phone license isn't available for them 2025-04-16 08:03:58 +05:30
WindowsAddict
e8bf344f74 Add support for O365 15.0 in TSforge because phone license exist 2025-04-16 06:14:40 +05:30
WindowsAddict
70162c4130 Add support for external LibTSforge.dll if found in BIN folder 2025-04-16 05:30:31 +05:30
WindowsAddict
294837dfe0 Add the updated CAS by abbodi1406 2025-04-16 03:47:15 +05:30
WindowsAddict
f5a0a63165 Cleanup leftover branding.xml related code 2025-04-15 08:39:39 +05:30
WindowsAddict
0d61475468 Fix an issue where Office doesn't need activation but TSforge would show phone license missing error 2025-04-15 07:02:19 +05:30
WindowsAddict
c316b42e5c Simplify the code related to "disable quickedit and avoid Terminal app" 2025-04-14 04:10:58 +05:30
WindowsAddict
3b739d7e2b Add malware check in Powershell test 2025-04-13 04:25:10 +05:30
WindowsAddict
8673fbbfda Add -nop -c with Powershell 2025-04-13 03:45:34 +05:30
WindowsAddict
60dd549a49 Don't add SharedComputerLicensing registry on Server for old Office versions 2025-04-12 20:07:24 +05:30
WindowsAddict
1e3c0aaedf Fix MSI Office detection for Visio and few other products 2025-04-12 19:00:48 +05:30
WindowsAddict
fe001e6c39 Elaborate help message 2025-03-16 03:04:40 +05:30
WindowsAddict
c4f33e96c4 Update WPA keys check code 2025-03-16 02:34:10 +05:30
WindowsAddict
313f240448 Change file hash 2025-03-14 15:30:16 +05:30
WindowsAddict
69f1a206fb Change file hash 2025-03-14 15:27:57 +05:30
WindowsAddict
ab0cd24f89 Add more checks for powershell 2025-02-24 00:36:35 +05:30
WindowsAddict
55afa30fcd Improve powershell test 2025-02-23 20:36:55 +05:30
WindowsAddict
5e7e42a446 Add a backup url in update check 2025-02-22 20:52:26 +05:30
WindowsAddict
a9eda8f572 Select 1 and 2Y ESU as well instead of only 3Y, just to be sure 2025-02-22 20:13:09 +05:30
WindowsAddict
a5bcfdd3e6 Update info in tsforge uninstall section 2025-02-22 19:50:37 +05:30
WindowsAddict
8d67d62c15 Update esu info 2025-02-18 04:44:35 +05:30
WindowsAddict
6adb247334 Update W10 ESU editions list as per 19045.5552 2025-02-18 03:42:42 +05:30
WindowsAddict
6c8732dd06 Correct the chart link in readme 2025-02-18 03:35:32 +05:30
WindowsAddict
9765e7d05f Revert-export-ignore 2025-02-13 23:17:18 +05:30
WindowsAddict
60c99742ce 3.0 2025-02-13 23:10:49 +05:30
WindowsAddict
8f3f392517 Add updated CAS 2025-02-03 23:57:37 +05:30
WindowsAddict
af69d79c5c check main domain 2025-02-03 19:32:03 +05:30
WindowsAddict
63045afc70 Remove activation not required line in HWID 2025-02-02 19:21:01 +05:30
WindowsAddict
19c6612a47 Optimize the tests 2025-02-02 18:25:46 +05:30
WindowsAddict
9e6f386819 Fix licensing servers tests 2025-02-02 18:13:28 +05:30
WindowsAddict
b5ba36c033 Remove UnQuickEdit in check activation script 2025-02-02 03:50:02 +05:30
WindowsAddict
d10b6d691e Update licensing servers test section 2025-02-01 21:18:21 +05:30
WindowsAddict
de812acdc5 show error info on screen when unable to connect to licensing servers 2025-01-31 18:25:56 +05:30
WindowsAddict
75c34cbf50 Add updated CAS by abbodi1406 2025-01-30 02:25:04 +05:30
WindowsAddict
0d533338a1 Use installed licences edition ids list only from 17063 2025-01-30 02:08:55 +05:30
WindowsAddict
411f387705 Fix a bug on 7 where it can't list multiple ids 2025-01-30 01:59:45 +05:30
WindowsAddict
be44b2d887 Don't check tasks if csvlk is installed, don't show wlms in red 2025-01-30 00:51:46 +05:30
WindowsAddict
0c88f6bc2c Change error detection for ImageState 2025-01-20 22:35:47 +05:30
WindowsAddict
d31e4ab0cb Remove error variable from non-critical errors 2025-01-17 21:58:29 +05:30
WindowsAddict
9fd5a661ab Change some variable names 2025-01-17 20:24:54 +05:30
WindowsAddict
b732e2c8d7 Remove permanent activated IDs check in Office scripts 2025-01-17 17:28:44 +05:30
WindowsAddict
8e2677b1f9 Check license files instead of folder in change edition 2025-01-17 04:34:03 +05:30
WindowsAddict
f2e40bf88e Fix an issue where the script doesn't show fix licensing suggestion 2025-01-09 00:44:02 +05:30
WindowsAddict
a4f9b219ab Change wordings 2025-01-09 00:21:13 +05:30
WindowsAddict
7262a44ba2 Add obscure product keys 2024-12-21 21:15:21 +05:30
WindowsAddict
37ec96504a Fix registry count 2024-12-21 15:48:02 +05:30
WindowsAddict
051b4f673f Revert export-ignore 2024-12-21 04:37:12 +05:30
15 changed files with 26470 additions and 4285 deletions

6
.gitattributes vendored
View File

@ -1,4 +1,4 @@
MAS export-ignore # MAS export-ignore
LICENSE export-ignore # LICENSE export-ignore
README.md export-ignore # README.md export-ignore
.gitattributes 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

View File

@ -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/

File diff suppressed because it is too large Load Diff

View 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

View File

@ -1,11 +1,11 @@
@set masver=2.9 @set masver=3.5
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass grave[.]dev :: Homepage: mass<>grave<.>dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=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 :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -60,6 +61,8 @@ exit /b
set "blank=" set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" 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 :: Check if Null service is working, it's important for the batch script
@ -69,7 +72,7 @@ echo:
echo Null service is not running, script may crash... echo Null service is not running, script may crash...
echo: echo:
echo: echo:
echo Help - %mas%fix_service echo Check this webpage for help - %mas%fix_service
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 ping 127.0.0.1 -n 20
@ -84,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 Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
echo: echo:
echo Help - %mas%troubleshoot echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
@ -123,10 +126,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 ( if %winbuild% LSS 7600 (
%nceline% %eline%
echo Unsupported OS version detected [%winbuild%]. 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 goto dk_done
) )
@ -162,33 +185,6 @@ goto dk_done
::======================================================================================================================================== ::========================================================================================================================================
:: Check PowerShell
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) || (
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 :: Elevate script as admin and pass arguments and preventing loop
%nul1% fltmc || ( %nul1% fltmc || (
@ -201,6 +197,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 :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
if %winbuild% GEQ 17763 ( if %winbuild% GEQ 17763 (
@ -211,34 +287,35 @@ set terminal=
:: Check if script is running in Terminal app :: 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 ( 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 defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
:: 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 ( if defined terminal (
set "launchcmd=start conhost.exe %psc%" start conhost.exe "!_batf!" %_args% -qedit
) else ( start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
set "launchcmd=%psc%" 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 :skipQE
::======================================================================================================================================== ::========================================================================================================================================
@ -247,9 +324,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -= set -=
set old= set old=
set pingp=
set upver=%masver:.=%
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do ( for %%A in (
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1)) 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 ( if defined old (
@ -265,7 +352,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem 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)
) )
) )
@ -279,15 +366,6 @@ echo:
echo Initializing... echo Initializing...
echo: echo:
if not exist %SysPath%\sppsvc.exe (
%eline%
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
::======================================================================================================================================== ::========================================================================================================================================
set spp=SoftwareLicensingProduct set spp=SoftwareLicensingProduct
@ -321,8 +399,7 @@ if %osedition%==0 (
%eline% %eline%
echo Failed to detect OS Edition. Aborting... echo Failed to detect OS Edition. Aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done goto dk_done
) )
@ -371,6 +448,7 @@ _updch
_lang _lang
_clversion _clversion
_version _version
_AudienceData
_oIds _oIds
_c2rXml _c2rXml
_c2rExe _c2rExe
@ -395,7 +473,7 @@ echo which is not officially supported on your Windows build version %winbuild%.
echo Aborting... echo Aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 goto dk_done
) )
@ -409,7 +487,7 @@ echo Unsupported Office %verchk% is installed on your Windows build version %win
echo Aborting... echo Aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 goto dk_done
) )
@ -498,9 +576,10 @@ goto :oe_edition
:oe_editionchangepre :oe_editionchangepre
cls cls
set editedition=
call :ch_getinfo call :ch_getinfo
call :oe_tempcleanup call :oe_tempcleanup
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
:oe_editionchange :oe_editionchange
@ -515,7 +594,7 @@ if not exist %SystemRoot%\Temp\%list%.txt (
echo Failed to generate available editions list. echo Failed to generate available editions list.
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 :oe_goback goto :oe_goback
) )
@ -574,13 +653,13 @@ cls
set suites= set suites=
echo %list% | find /i "Suites" %nul1% && ( echo %list% | find /i "Suites" %nul1% && (
set suites=1 set suites=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getappnames\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
if not exist %SystemRoot%\Temp\getAppIds.txt ( if not exist %SystemRoot%\Temp\getAppIds.txt (
%eline% %eline%
echo Failed to generate available apps list. echo Failed to generate available apps list.
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 :oe_goback goto :oe_goback
) )
) )
@ -616,7 +695,8 @@ if not defined terminal mode 98, 32
%line% %line%
echo: echo:
call :dk_color %Gray% "Target edition: %targetedition%" call :dk_color %Gray% "Target edition: %targetedition%"
call :dk_color %Gray% "You can exclude the below apps from installation." call :dk_color %Gray% "To exclude the apps listed below from installation, toggle them from On to Off."
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps."
%line% %line%
if defined suites echo: if defined suites echo:
if defined Access_st echo [A] Access : %Access_st% if defined Access_st echo [A] Access : %Access_st%
@ -743,7 +823,9 @@ goto :oe_goback
:: OfficeClickToRun.exe with productstoadd method is used here to add editions :: OfficeClickToRun.exe with productstoadd method is used here to add editions
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet :: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" call :oe_getlangs
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
if %change%==1 ( if %change%==1 (
set "c2rcommand=!c2rcommand! productstoremove=AllProducts" set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
@ -758,11 +840,43 @@ set errorcode=%errorlevel%
timeout /t 10 %nul% timeout /t 10 %nul%
echo: echo:
set suggestchannel=
if %errorcode% EQU 0 ( if %errorcode% EQU 0 (
call :dk_color %Gray% "Now run the Office activation option from the main menu." if %change%==1 (
echo %targetedition% | find /i "2019Volume" %nul% && (
if not defined ltsc19 set suggestchannel=Production::LTSC
if /i not %_AudienceData%==Production::LTSC set suggestchannel=Production::LTSC
if /i not %_updch%==F2E724C1-748F-4B47-8FB8-8E0D210E9208 set suggestchannel=Production::LTSC
)
echo %targetedition% | find /i "2021Volume" %nul% && (
if not defined ltsc21 set suggestchannel=Production::LTSC2021
if /i not %_AudienceData%==Production::LTSC2021 set suggestchannel=Production::LTSC2021
if /i not %_updch%==5030841D-C919-4594-8D2D-84AE4F96E58E set suggestchannel=Production::LTSC2021
)
echo %targetedition% | find /i "2024Volume" %nul% && (
if not defined ltsc24 set suggestchannel=Production::LTSC2024
if /i not %_AudienceData%==Production::LTSC2024 set suggestchannel=Production::LTSC2024
if /i not %_updch%==7983BAC0-E531-40CF-BE00-FD24FE66619C set suggestchannel=Production::LTSC2024
)
echo %targetedition% | findstr /R "20.*Volume" %nul% || (
if defined ltscfound set suggestchannel=Production::CC
echo %_AudienceData% | find /i "LTSC" %nul% && set suggestchannel=Production::CC
)
if defined suggestchannel (
call :dk_color %Gray% "Mismatch found in update channel and installed product."
call :dk_color %Blue% "It is recommended to change the update channel to [!suggestchannel!] from the previous menu."
)
echo:
)
call :dk_color %Gray% "To activate Office, run the activation option from the main menu."
) else ( ) else (
set fixes=%fixes% %mas%troubleshoot 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"
) )
call :oe_tempcleanup call :oe_tempcleanup
@ -783,6 +897,7 @@ goto :oe_goback
) )
set change=0 set change=0
set editedition=1
call :ch_getinfo call :ch_getinfo
cls cls
@ -888,13 +1003,8 @@ if %verified%==0 goto :oe_removeedition
cls cls
if not defined terminal mode 105, 32 if not defined terminal mode 105, 32
set _lang= call :oe_getlangs %targetedition%
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9) set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16_%_allLangs%"
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%targetedition%.16" /f "-" /k ^| findstr /i ".*16\\.*-.*"') do (
if defined _lang (set "_lang=!_lang!_%%a") else (set "_lang=_%%a")
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16%_lang%"
echo: echo:
echo Running the below command, please wait... echo Running the below command, please wait...
@ -905,7 +1015,7 @@ echo %c2rcommand%
if %errorlevel% NEQ 0 ( if %errorlevel% NEQ 0 (
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 :oe_goback goto :oe_goback
@ -936,6 +1046,12 @@ echo Installed Office editions: %_oIds%
echo Unsupported Office edition is installed on your Windows build version %winbuild%. echo Unsupported Office edition is installed on your Windows build version %winbuild%.
goto :oe_goback goto :oe_goback
) )
if defined ltscfound (
%eline%
echo Installed Office update channel: %ltsc19%%ltsc21%%ltsc24%
echo Unsupported Office update channel is installed on your Windows build version %winbuild%.
goto :oe_goback
)
) )
::=============== ::===============
@ -944,49 +1060,52 @@ set inpt=
set counter=0 set counter=0
set verified=0 set verified=0
set targetFFN= set targetFFN=
set bypassFFN=
set targetchannel= set targetchannel=
%line% %line%
echo: echo:
call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%" call :dk_color %Gray% "Installed update channel: %_AudienceData%, %_version%, Client: %_clversion%"
call :dk_color %Gray% "Unsupported update channels are excluded from this list." call :dk_color %Gray% "Installed Office editions: %_oIds%"
%line% %line%
echo: echo:
for %%# in ( for %%# in (
"5440FD1F-7ECB-4221-8110-145EFAA6372F_Insider Fast [Beta] - Insiders::DevMain" "5440fd1f-7ecb-4221-8110-145efaa6372f_Insider Fast [Beta] - Insiders::DevMain -"
"64256AFE-F5D9-4F86-8936-8840A6A4F5BE_Monthly Preview - Insiders::CC" "64256afe-f5d9-4f86-8936-8840a6a4f5be_Monthly Preview - Insiders::CC -"
"492350F6-3A01-4F97-B9C0-C7C6DDF67D60_Monthly [Current] - Production::CC" "492350f6-3a01-4f97-b9c0-c7c6ddf67d60_Monthly [Current] - Production::CC -"
"55336B82-A18D-4DD6-B5F6-9E5095C314A6_Monthly Enterprise - Production::MEC" "55336b82-a18d-4dd6-b5f6-9e5095c314a6_Monthly Enterprise - Production::MEC -"
"B8F9B850-328D-4355-9145-C59439A0C4CF_Semi Annual Preview - Insiders::FRDC" "b8f9b850-328d-4355-9145-c59439a0c4cf_Semi Annual Preview - Insiders::FRDC -"
"7FFBC6BF-BC32-4F92-8982-F9DD17FD3114_Semi Annual - Production::DC" "7ffbc6bf-bc32-4f92-8982-f9dd17fd3114_Semi Annual - Production::DC -"
"EA4A4090-DE26-49D7-93C1-91BFF9E53FC3_DevMain Channel - Dogfood::DevMain" "ea4a4090-de26-49d7-93c1-91bff9e53fc3_DevMain Channel - Dogfood::DevMain -"
"B61285DD-D9F7-41F2-9757-8F61CBA4E9C8_Microsoft Elite - Microsoft::DevMain" "b61285dd-d9f7-41f2-9757-8f61cba4e9c8_Microsoft Elite - Microsoft::DevMain -"
"F2E724C1-748F-4B47-8FB8-8E0D210E9208_Perpetual2019 VL - Production::LTSC" "f2e724c1-748f-4b47-8fb8-8e0d210e9208_Perpetual2019 VL - Production::LTSC -"
"1D2D2EA6-1680-4C56-AC58-A441C8C24FF9_Microsoft2019 VL - Microsoft::LTSC" "1d2d2ea6-1680-4c56-ac58-a441c8c24ff9_Microsoft2019 VL - Microsoft::LTSC -"
"5030841D-C919-4594-8D2D-84AE4F96E58E_Perpetual2021 VL - Production::LTSC2021" "5030841d-c919-4594-8d2d-84ae4f96e58e_Perpetual2021 VL - Production::LTSC2021 -"
"86752282-5841-4120-AC80-DB03AE6B5FDB_Microsoft2021 VL - Microsoft::LTSC2021" "86752282-5841-4120-ac80-db03ae6b5fdb_Microsoft2021 VL - Microsoft::LTSC2021 -"
"7983BAC0-E531-40CF-BE00-FD24FE66619C_Perpetual2024 VL - Production::LTSC2024" "7983bac0-e531-40cf-be00-fd24fe66619c_Perpetual2024 VL - Production::LTSC2024 -"
"C02D8FE6-5242-4DA8-972F-82EE55E00671_Microsoft2024 VL - Microsoft::LTSC2024" "c02d8fe6-5242-4da8-972f-82ee55e00671_Microsoft2024 VL - Microsoft::LTSC2024 -"
) do ( ) do (
for /f "tokens=1-2 delims=_" %%A in ("%%~#") do ( for /f "tokens=1-2 delims=_" %%A in ("%%~#") do (
set bypass=
set supported= set supported=
if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1) if %winbuild% LSS 10240 (echo %%B | findstr /i "LTSC DevMain" %nul% || set supported=1) else (set supported=1)
if %winbuild% GEQ 10240 ( if %winbuild% GEQ 10240 (
if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set supported= if defined ltsc19 echo %%B | find /i "2019 VL" %nul% || set bypass=1
if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set supported= if defined ltsc21 echo %%B | find /i "2021 VL" %nul% || set bypass=1
if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set supported= if defined ltsc24 echo %%B | find /i "2024 VL" %nul% || set bypass=1
if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set supported= if not defined ltscfound echo %%B | find /i "LTSC" %nul% && set bypass=1
) )
if defined supported ( if defined supported (
set /a counter+=1 set /a counter+=1
if !counter! LSS 10 ( if !counter! LSS 10 (
echo [!counter!] %%B if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
) else ( ) else (
echo [!counter!] %%B if defined bypass (echo [!counter!] %%B Unofficial change method will be used) else (echo [!counter!] %%B)
) )
set targetFFN!counter!=%%A set targetFFN!counter!=%%A
set targetchannel!counter!=%%B set targetchannel!counter!=%%B
if defined bypass set bypassFFN=!bypassFFN!%%A
) )
) )
) )
@ -1000,7 +1119,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
set /p inpt= set /p inpt=
if "%inpt%"=="" goto :oe_changeupdchnl if "%inpt%"=="" goto :oe_changeupdchnl
if "%inpt%"=="0" goto :oemenu if "%inpt%"=="0" goto :oemenu
if /i "%inpt%"=="R" start https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl if /i "%inpt%"=="R" start https://learn.microsoft.com/en-us/microsoft-365-apps/updates/overview-update-channels & goto :oe_changeupdchnl
for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1) for /l %%i in (1,1,%counter%) do (if "%inpt%"=="%%i" set verified=1)
set targetFFN=!targetFFN%inpt%! set targetFFN=!targetFFN%inpt%!
set targetchannel=!targetchannel%inpt%! set targetchannel=!targetchannel%inpt%!
@ -1014,18 +1133,148 @@ if not defined terminal mode 105, 32
:: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results :: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results
set build= set build=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a)
echo "%build%" | find /i "16." %nul% || set build= echo "%build%" | find /i "16." %nul% || set build=
echo:
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
echo Target build number: %build%
echo: %bypassFFN% | find /i "%targetFFN%" %nul% && goto :oe_changeunoff
call :oe_cleanupreg
if not defined build (
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
set "updcommand="%_c2rCexe%" /update user"
) else (
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
)
echo Running the below command to trigger updates...
echo:
echo %updcommand%
%updcommand%
echo:
echo Check this webpage for help - %mas%troubleshoot
goto :oe_goback
::=======================
:: Unofficial method to change channel
:oe_changeunoff
set abortchange=
echo %targetchannel% | find /i "2019 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2019Volume" %nul% || set abortchange=1))
echo %targetchannel% | find /i "2021 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2021Volume" %nul% || set abortchange=1))
echo %targetchannel% | find /i "2024 VL" %nul% && (for %%A in (%_oIds%) do (echo %%A | find /i "2024Volume" %nul% || set abortchange=1))
if defined abortchange (
%eline%
echo Mismatch found in installed Office products and target update channel. Aborting...
echo Non-perpetual Office products are not suppported with Perpetual VL update channels.
goto :oe_goback
)
if not defined build (
%eline%
call :dk_color %Red% "Failed to detect build number for the target FFN."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto :oe_goback
)
set buildchk=0
for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a"
call :oe_getlangs %_firstoId%
echo %targetchannel% | find /i "2019 VL" %nul% && (
for %%A in (en-gb es-mx fr-ca) do (
echo %_allLangs% | find /i "%%A" %nul% && (
%eline%
echo [%%A] language is not supported on the Office 2019 Perpetual VL update channel. Aborting...
goto :oe_goback
)
)
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE"
if %clverchk% LSS %buildchk% (
echo:
call :dk_color %Blue% "Do not terminate the operation before it completes..."
echo:
echo Updating Office C2R client with the command below, please wait...
echo:
echo %c2rclientupdate%
%c2rclientupdate%
for /l %%i in (1,1,30) do (if !clverchk! LSS %buildchk% (call :ch_getinfo&timeout /t 10 %nul%))
)
if %clverchk% LSS %buildchk% (
echo:
call :dk_color %Red% "Failed to update Office C2R client. Aborting..."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto :oe_goback
)
call :oe_cleanupreg
echo Running the below command to change update channel, please wait...
echo:
echo %c2rcommand%
%c2rcommand%
set errorcode=%errorlevel%
timeout /t 10 %nul%
echo:
if %errorcode% EQU 0 (
call :dk_color %Gray% "Now run the Office activation option from the main menu."
) else (
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
)
::========================================================================================================================================
:oe_goback
call :oe_tempcleanup
echo:
if defined fixes (
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!==2 goto :oemenu
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
call :dk_color %_Yellow% "Press [0] key to go back..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to go back..."
pause %nul1%
)
goto :oemenu
::========================================================================================================================================
:oe_cleanupreg
:: Cleanup Office update related registries, thanks to @abbodi1406 :: Cleanup Office update related registries, thanks to @abbodi1406
:: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813 :: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-manage-office-365-proplus-channels-for-it-pros/ba-p/795813
:: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels :: https://learn.microsoft.com/en-us/microsoft-365-apps/updates/change-update-channels#considerations-when-changing-channels
echo:
for /f "tokens=1 delims=-" %%A in ("%targetchannel%") do (echo Target update channel: %%A)
echo: echo:
echo Cleaning Office update registry keys... echo Cleaning Office update registry keys...
echo Adding new update channel to registry keys... echo Adding new update channel to registry keys...
echo:
%nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f %nul% reg add %o16c2r_reg%\Configuration /v CDNBaseUrl /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
%nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f %nul% reg add %o16c2r_reg%\Configuration /v UpdateChannel /t REG_SZ /d "https://officecdn.microsoft.com/pr/%targetFFN%" /f
@ -1042,42 +1291,7 @@ echo Adding new update channel to registry keys...
%nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32 %nul% reg delete HKLM\SOFTWARE\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f /reg:32
%nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f %nul% reg delete HKCU\Software\Policies\Microsoft\cloud\office\16.0\Common\officeupdate /f
if not defined build ( exit /b
if %winbuild% GEQ 9200 call :dk_color %Gray% "Failed to detect build number for the target FFN."
set "updcommand="%_c2rCexe%" /update user"
) else (
set "updcommand="%_c2rCexe%" /update user updatetoversion=%build%"
)
echo Running the below command to trigger updates...
echo:
echo %updcommand%
%updcommand%
echo:
echo Help - %mas%troubleshoot
goto :oe_goback
::========================================================================================================================================
:oe_goback
call :oe_tempcleanup
echo:
if defined fixes (
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 defined terminal (
call :dk_color %_Yellow% "Press [0] key to go back..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to go back..."
pause %nul1%
)
goto :oemenu
::======================================================================================================================================== ::========================================================================================================================================
@ -1100,6 +1314,7 @@ set _oRoot=
set _oArch= set _oArch=
set _updch= set _updch=
set _oIds= set _oIds=
set _firstoId=
set _lang= set _lang=
set _cfolder= set _cfolder=
set _version= set _version=
@ -1130,9 +1345,13 @@ for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseI
if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a") if defined _oIds (set "_oIds=!_oIds! %%a") else (set "_oIds=%%a")
) )
set _oIds=%_oIds:.16=% set _oIds=%_oIds:.16=%
for /f "tokens=1" %%A in ("%_oIds%") do set _firstoId=%%A
for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\Configuration /v %_firstoId%.ExcludedApps" %nul6%') do (set "_firstoIdExcludelist=%%b")
set verchk=0 set verchk=0
set clverchk=0
for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a" for /f "tokens=3 delims=." %%a in ("%_version%") do set "verchk=%%a"
for /f "tokens=3 delims=." %%a in ("%_clversion%") do set "clverchk=%%a"
if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" if exist "%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml" set "_c2rXml=%_oRoot%\Licenses16\c2rpridslicensefiles_auto.xml"
@ -1148,16 +1367,13 @@ if exist "%_cfolder%\OfficeC2RClient.exe" (
set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe" set "_c2rCexe=%_cfolder%\OfficeC2RClient.exe"
) )
set "audidata4=%_AudienceData:~-4%" :: Check LTSC version files
if /i "%audidata4%"=="LTSC" set ltsc19=LTSC for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg%\ProductReleaseIDs\%_actconfig%" /s %nul6%') do (
echo %_clversion% %_version% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC echo "%%b" %nul2% | findstr "16.0.103 16.0.104 16.0.105" %nul% && set ltsc19=LTSC
echo "%%b" %nul2% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021
if /i "%audidata4%"=="2021" set ltsc21=LTSC2021 echo "%%b" %nul2% | findstr "16.0.17932" %nul% && set ltsc24=LTSC2024
echo %_clversion% %_version% | findstr "16.0.14332" %nul% && set ltsc21=LTSC2021 )
if /i "%audidata4%"=="2024" set ltsc24=LTSC2024
:: LTSC 2024 build is not fixed yet
if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1 if not "%ltsc19%%ltsc21%%ltsc24%"=="" set ltscfound=1
@ -1165,6 +1381,27 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:: Check all the installed languages
:oe_getlangs
if "%1"=="" (
set langreg=culture
) else (
set langreg=%1.16
)
set _allLangs=
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%langreg%" /f "-" /k ^| findstr /i "%langreg%\\.*-.*"') do (
if defined _allLangs (set "_allLangs=!_allLangs!_%%a") else (set "_allLangs=%%a")
)
set _allLangs=%_allLangs:.16=%
exit /b
::========================================================================================================================================
:: Check Internet connection :: Check Internet connection
:oe_chkinternet :oe_chkinternet
@ -1308,9 +1545,15 @@ if ($appIdsList.Count -gt 0) {
:dk_setvar :dk_setvar
set psc=powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c
set winbuild=1 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 set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 if %winbuild% LSS 10586 set _NCS=0
@ -1358,6 +1601,7 @@ exit /b
:dk_ckeckwmic :dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0 set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( 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 cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@ -1368,16 +1612,16 @@ exit /b
:dk_sppissue :dk_sppissue
sc start sppsvc %nul% sc start %_slser% %nul%
set spperror=%errorlevel% set spperror=%errorlevel%
if %spperror% NEQ 1056 if %spperror% NEQ 0 ( if %spperror% NEQ 1056 if %spperror% NEQ 0 (
%eline% %eline%
echo sc start sppsvc [Error Code: %spperror%] echo sc start %_slser% [Error Code: %spperror%]
) )
echo: echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" %psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
exit /b exit /b
:: Common lines used in PowerShell reflection code :: Common lines used in PowerShell reflection code
@ -1395,8 +1639,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[0m echo %esc%[%~1%~2%esc%[0m
) else ( ) else if exist %ps% (
%psc% write-host -back '%1' -fore '%2' '%3' %psc% write-host -back '%1' -fore '%2' '%3'
) else if not exist %ps% (
echo %~3
) )
exit /b exit /b
@ -1404,8 +1650,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m 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' %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 exit /b
@ -1420,7 +1668,8 @@ if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " 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" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (

View File

@ -1,11 +1,11 @@
@set masver=2.9 @set masver=3.5
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass grave[.]dev :: Homepage: mass<>grave<.>dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -42,6 +42,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=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 :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -65,6 +66,8 @@ exit /b
set "blank=" set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" 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 :: Check if Null service is working, it's important for the batch script
@ -74,7 +77,7 @@ echo:
echo Null service is not running, script may crash... echo Null service is not running, script may crash...
echo: echo:
echo: echo:
echo Help - %mas%fix_service echo Check this webpage for help - %mas%fix_service
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 ping 127.0.0.1 -n 20
@ -89,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 Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
echo: echo:
echo Help - %mas%troubleshoot echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
@ -128,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 ( if %winbuild% LSS 7600 (
%nceline% %eline%
echo Unsupported OS version detected [%winbuild%]. 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 goto dk_done
) )
@ -167,33 +190,6 @@ goto dk_done
::======================================================================================================================================== ::========================================================================================================================================
:: Check PowerShell
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) || (
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 :: Elevate script as admin and pass arguments and preventing loop
%nul1% fltmc || ( %nul1% fltmc || (
@ -206,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 :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
if %winbuild% GEQ 17763 ( if %winbuild% GEQ 17763 (
@ -216,34 +292,35 @@ set terminal=
:: Check if script is running in Terminal app :: 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 ( 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 defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
:: 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 ( if defined terminal (
set "launchcmd=start conhost.exe %psc%" start conhost.exe "!_batf!" %_args% -qedit
) else ( start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
set "launchcmd=%psc%" 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 :skipQE
::======================================================================================================================================== ::========================================================================================================================================
@ -252,9 +329,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -= set -=
set old= set old=
set pingp=
set upver=%masver:.=%
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do ( for %%A in (
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1)) 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 ( if defined old (
@ -270,7 +357,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem 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)
) )
) )
@ -310,8 +397,11 @@ if not exist %SysPath%\%%# (
%eline% %eline%
echo [%SysPath%\%%#] file is missing, aborting... echo [%SysPath%\%%#] file is missing, aborting...
echo: 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 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 goto dk_done
) )
) )
@ -343,8 +433,7 @@ if not defined allapps (
%eline% %eline%
echo Failed to find activation IDs. Aborting... echo Failed to find activation IDs. Aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done goto dk_done
) )
@ -366,8 +455,7 @@ if not defined osedition (
%eline% %eline%
echo Failed to detect OS edition, aborting... echo Failed to detect OS edition, aborting...
echo: echo:
set fixes=%fixes% %mas%troubleshoot call :dk_color %Blue% "To fix this issue, activate Windows from the main menu."
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
goto dk_done goto dk_done
) )
@ -390,10 +478,10 @@ set _ntarget=
set _wtarget= 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% 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" ( 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:~0,4%"=="Core" set _pro=Professional
if /i "%osedition%"=="CoreN" set _pro=ProfessionalN if /i "%osedition%"=="CoreN" set _pro=ProfessionalN
set "_dtarget= %_dtarget% !_wtarget! !_pro! " set "_dtarget= %_dtarget% !_wtarget! !_pro! "
@ -506,7 +594,7 @@ set _dismapi=0
:: Check if DISM API or slmgr.vbs is required for edition upgrade :: 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% " || ( echo %_wtarget% | find /i " %targetedition% " || (
set _dismapi=1 set _dismapi=1
) )
@ -529,7 +617,7 @@ echo [%targetedition% ^| %winbuild%]
echo Failed to get product key from pkeyhelper.dll. echo Failed to get product key from pkeyhelper.dll.
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 goto dk_done
) )
@ -584,7 +672,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition."
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]" call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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"
) )
) )
@ -596,7 +684,7 @@ echo:
call :ced_prep call :ced_prep
if defined preperror goto dk_done 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 call :ced_postprep
) )
%line% %line%
@ -634,7 +722,7 @@ call :ced_prep
if defined preperror goto dk_done if defined preperror goto dk_done
if %_stg%==0 (set stage=) else (set stage=-StageCurrent) 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 call :ced_postprep
%line% %line%
@ -665,7 +753,7 @@ echo [%targetedition% ^| %winbuild%]
echo Failed to get product key from pkeyhelper.dll. echo Failed to get product key from pkeyhelper.dll.
echo: echo:
set fixes=%fixes% %mas%troubleshoot 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 goto dk_done
) )
@ -741,14 +829,14 @@ echo:
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again." call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
echo: echo:
set fixes=%fixes% %mas%change_edition_issues 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 exit /b
:compresslog :compresslog
:: https://stackoverflow.com/a/46268232 :: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\ddf"" set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
%nul% del /q /f %ddf% %nul% del /q /f %ddf%
echo/.New Cabinet>%ddf% echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf% echo/.set Cabinet=ON>>%ddf%
@ -780,9 +868,15 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c
set winbuild=1 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 set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 if %winbuild% LSS 10586 set _NCS=0
@ -857,6 +951,7 @@ exit /b
:dk_ckeckwmic :dk_ckeckwmic
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
set _wmic=0 set _wmic=0
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( 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 cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
@ -867,16 +962,16 @@ exit /b
:dk_sppissue :dk_sppissue
sc start sppsvc %nul% sc start %_slser% %nul%
set spperror=%errorlevel% set spperror=%errorlevel%
if %spperror% NEQ 1056 if %spperror% NEQ 0 ( if %spperror% NEQ 1056 if %spperror% NEQ 0 (
%eline% %eline%
echo sc start sppsvc [Error Code: %spperror%] echo sc start %_slser% [Error Code: %spperror%]
) )
echo: echo:
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" %psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
exit /b exit /b
:: Common lines used in PowerShell reflection code :: Common lines used in PowerShell reflection code
@ -974,8 +1069,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[0m echo %esc%[%~1%~2%esc%[0m
) else ( ) else if exist %ps% (
%psc% write-host -back '%1' -fore '%2' '%3' %psc% write-host -back '%1' -fore '%2' '%3'
) else if not exist %ps% (
echo %~3
) )
exit /b exit /b
@ -983,8 +1080,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m 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' %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 exit /b
@ -999,7 +1098,8 @@ if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " 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" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
@ -1288,55 +1388,55 @@ if %winbuild% GEQ 22000 exit /b
) )
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=) if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set Cor=Cor) else (set Cor=)
set h= set w=
for %%# in ( for %%# in (
XGVPP-NMH47-7TTHJ-W3FW7-8HV%h%2C__OEM:NONSLP_Enterprise XGVPP-NMH47-7TTHJ-W3FW7-8HV%w%2C__OEM:NONSLP_Enterprise
D6RD9-D4N8T-RT9QX-YW6YT-FCW%h%WJ______Retail_Starter D6RD9-D4N8T-RT9QX-YW6YT-FCW%w%WJ______Retail_Starter
3V6Q6-NQXCX-V8YXR-9QCYV-QPF%h%CT__Volume:MAK_EnterpriseN 3V6Q6-NQXCX-V8YXR-9QCYV-QPF%w%CT__Volume:MAK_EnterpriseN
3NFXW-2T27M-2BDW6-4GHRV-68X%h%RX______Retail_StarterN 3NFXW-2T27M-2BDW6-4GHRV-68X%w%RX______Retail_StarterN
VK7JG-NPHTM-C97JM-9MPGT-3V6%h%6T______Retail_Professional VK7JG-NPHTM-C97JM-9MPGT-3V6%w%6T______Retail_Professional
2B87N-8KFHP-DKV6R-Y2C8J-PKC%h%KT______Retail_ProfessionalN 2B87N-8KFHP-DKV6R-Y2C8J-PKC%w%KT______Retail_ProfessionalN
4CPRK-NM3K3-X6XXQ-RXX86-WXC%h%HW______Retail_CoreN 4CPRK-NM3K3-X6XXQ-RXX86-WXC%w%HW______Retail_CoreN
N2434-X9D7W-8PF6X-8DV9T-8TY%h%MD______Retail_CoreCountrySpecific N2434-X9D7W-8PF6X-8DV9T-8TY%w%MD______Retail_CoreCountrySpecific
BT79Q-G7N6G-PGBYW-4YWX6-6F4%h%BT______Retail_CoreSingleLanguage BT79Q-G7N6G-PGBYW-4YWX6-6F4%w%BT______Retail_CoreSingleLanguage
YTMG3-N6DKC-DKB77-7M9GH-8HV%h%X7______Retail_Core YTMG3-N6DKC-DKB77-7M9GH-8HV%w%X7______Retail_Core
XKCNC-J26Q9-KFHD2-FKTHY-KD7%h%2Y__OEM:NONSLP_PPIPro XKCNC-J26Q9-KFHD2-FKTHY-KD7%w%2Y__OEM:NONSLP_PPIPro
YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%h%BY______Retail_Education YNMGQ-8RYV3-4PGQ3-C8XTP-7CF%w%BY______Retail_Education
84NGF-MHBT6-FXBX8-QWJK7-DRR%h%8H______Retail_EducationN 84NGF-MHBT6-FXBX8-QWJK7-DRR%w%8H______Retail_EducationN
KCNVH-YKWX8-GJJB9-H9FDT-6F7%h%W2__Volume:MAK_EnterpriseS_VB KCNVH-YKWX8-GJJB9-H9FDT-6F7%w%W2__Volume:MAK_EnterpriseS_VB
43TBQ-NH92J-XKTM7-KT3KK-P39%h%PB__OEM:NONSLP_EnterpriseS_RS5 43TBQ-NH92J-XKTM7-KT3KK-P39%w%PB__OEM:NONSLP_EnterpriseS_RS5
NK96Y-D9CD8-W44CQ-R8YTK-DYJ%h%WX__OEM:NONSLP_EnterpriseS_RS1 NK96Y-D9CD8-W44CQ-R8YTK-DYJ%w%WX__OEM:NONSLP_EnterpriseS_RS1
FWN7H-PF93Q-4GGP8-M8RF3-MDW%h%WW__OEM:NONSLP_EnterpriseS_TH FWN7H-PF93Q-4GGP8-M8RF3-MDW%w%WW__OEM:NONSLP_EnterpriseS_TH
RQFNW-9TPM3-JQ73T-QV4VQ-DV9%h%PT__Volume:MAK_EnterpriseSN_VB RQFNW-9TPM3-JQ73T-QV4VQ-DV9%w%PT__Volume:MAK_EnterpriseSN_VB
M33WV-NHY3C-R7FPM-BQGPT-239%h%PG__Volume:MAK_EnterpriseSN_RS5 M33WV-NHY3C-R7FPM-BQGPT-239%w%PG__Volume:MAK_EnterpriseSN_RS5
2DBW3-N2PJG-MVHW3-G7TDK-9HK%h%R4__Volume:MAK_EnterpriseSN_RS1 2DBW3-N2PJG-MVHW3-G7TDK-9HK%w%R4__Volume:MAK_EnterpriseSN_RS1
NTX6B-BRYC2-K6786-F6MVQ-M7V%h%2X__Volume:MAK_EnterpriseSN_TH NTX6B-BRYC2-K6786-F6MVQ-M7V%w%2X__Volume:MAK_EnterpriseSN_TH
G3KNM-CHG6T-R36X3-9QDG6-8M8%h%K9______Retail_ProfessionalSingleLanguage G3KNM-CHG6T-R36X3-9QDG6-8M8%w%K9______Retail_ProfessionalSingleLanguage
HNGCC-Y38KG-QVK8D-WMWRK-X86%h%VK______Retail_ProfessionalCountrySpecific HNGCC-Y38KG-QVK8D-WMWRK-X86%w%VK______Retail_ProfessionalCountrySpecific
DXG7C-N36C4-C4HTG-X4T3X-2YV%h%77______Retail_ProfessionalWorkstation DXG7C-N36C4-C4HTG-X4T3X-2YV%w%77______Retail_ProfessionalWorkstation
WYPNQ-8C467-V2W6J-TX4WX-WT2%h%RQ______Retail_ProfessionalWorkstationN WYPNQ-8C467-V2W6J-TX4WX-WT2%w%RQ______Retail_ProfessionalWorkstationN
8PTT6-RNW4C-6V7J2-C2D3X-MHB%h%PB______Retail_ProfessionalEducation 8PTT6-RNW4C-6V7J2-C2D3X-MHB%w%PB______Retail_ProfessionalEducation
GJTYN-HDMQY-FRR76-HVGC7-QPF%h%8P______Retail_ProfessionalEducationN GJTYN-HDMQY-FRR76-HVGC7-QPF%w%8P______Retail_ProfessionalEducationN
C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%h%JC__Volume:MAK_EnterpriseG C4NTJ-CX6Q2-VXDMR-XVKGM-F9D%w%JC__Volume:MAK_EnterpriseG
46PN6-R9BK9-CVHKB-HWQ9V-MBJ%h%Y8__Volume:MAK_EnterpriseGN 46PN6-R9BK9-CVHKB-HWQ9V-MBJ%w%Y8__Volume:MAK_EnterpriseGN
NJCF7-PW8QT-3324D-688JX-2YV%h%66______Retail_ServerRdsh NJCF7-PW8QT-3324D-688JX-2YV%w%66______Retail_ServerRdsh
XQQYW-NFFMW-XJPBH-K8732-CKF%h%FD______OEM:DM_IoTEnterprise XQQYW-NFFMW-XJPBH-K8732-CKF%w%FD______OEM:DM_IoTEnterprise
QPM6N-7J2WJ-P88HH-P3YRH-YY7%h%4H__OEM:NONSLP_IoTEnterpriseS QPM6N-7J2WJ-P88HH-P3YRH-YY7%w%4H__OEM:NONSLP_IoTEnterpriseS
K9VKN-3BGWV-Y624W-MCRMQ-BHD%h%CD______Retail_CloudEditionN K9VKN-3BGWV-Y624W-MCRMQ-BHD%w%CD______Retail_CloudEditionN
KY7PN-VR6RX-83W6Y-6DDYQ-T6R%h%4W______Retail_CloudEdition KY7PN-VR6RX-83W6Y-6DDYQ-T6R%w%4W______Retail_CloudEdition
V3WVW-N2PV2-CGWC3-34QGF-VMJ%h%2C______Retail_Cloud V3WVW-N2PV2-CGWC3-34QGF-VMJ%w%2C______Retail_Cloud
NH9J3-68WK7-6FB93-4K3DF-DJ4%h%F6______Retail_CloudN NH9J3-68WK7-6FB93-4K3DF-DJ4%w%F6______Retail_CloudN
2HN6V-HGTM8-6C97C-RK67V-JQP%h%FD______Retail_CloudE 2HN6V-HGTM8-6C97C-RK67V-JQP%w%FD______Retail_CloudE
WC2BQ-8NRM3-FDDYY-2BFGV-KHK%h%QY_Volume:GVLK_ServerStandard%Cor%_RS1 WC2BQ-8NRM3-FDDYY-2BFGV-KHK%w%QY_Volume:GVLK_ServerStandard%Cor%_RS1
CB7KF-BWN84-R7R2Y-793K2-8XD%h%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1 CB7KF-BWN84-R7R2Y-793K2-8XD%w%DG_Volume:GVLK_ServerDatacenter%Cor%_RS1
JCKRF-N37P4-C2D82-9YXRT-4M6%h%3B_Volume:GVLK_ServerSolution_RS1 JCKRF-N37P4-C2D82-9YXRT-4M6%w%3B_Volume:GVLK_ServerSolution_RS1
QN4C6-GBJD2-FB422-GHWJK-GJG%h%2R_Volume:GVLK_ServerCloudStorage_RS1 QN4C6-GBJD2-FB422-GHWJK-GJG%w%2R_Volume:GVLK_ServerCloudStorage_RS1
VP34G-4NPPG-79JTQ-864T4-R3M%h%QX_Volume:GVLK_ServerAzureCor_RS1 VP34G-4NPPG-79JTQ-864T4-R3M%w%QX_Volume:GVLK_ServerAzureCor_RS1
9JQNQ-V8HQ6-PKB8H-GGHRY-R62%h%H6______Retail_ServerAzureNano_RS1 9JQNQ-V8HQ6-PKB8H-GGHRY-R62%w%H6______Retail_ServerAzureNano_RS1
VN8D3-PR82H-DB6BJ-J9P4M-92F%h%6J______Retail_ServerStorageStandard_RS1 VN8D3-PR82H-DB6BJ-J9P4M-92F%w%6J______Retail_ServerStorageStandard_RS1
48TQX-NVK3R-D8QR3-GTHHM-8FH%h%XC______Retail_ServerStorageWorkgroup_RS1 48TQX-NVK3R-D8QR3-GTHHM-8FH%w%XC______Retail_ServerStorageWorkgroup_RS1
2HXDN-KRXHB-GPYC7-YCKFJ-7FV%h%DG_Volume:GVLK_ServerDatacenterACor_RS3 2HXDN-KRXHB-GPYC7-YCKFJ-7FV%w%DG_Volume:GVLK_ServerDatacenterACor_RS3
PTXN8-JFHJM-4WC78-MPCBR-9W4%h%KR_Volume:GVLK_ServerStandardACor_RS3 PTXN8-JFHJM-4WC78-MPCBR-9W4%w%KR_Volume:GVLK_ServerStandardACor_RS3
) do ( ) do (
for /f "tokens=1-4 delims=_" %%A in ("%%#") do if /i %targetedition%==%%C ( for /f "tokens=1-4 delims=_" %%A in ("%%#") do if /i %targetedition%==%%C (

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
@set masver=2.9 @set masver=3.5
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass grave[.]dev :: Homepage: mass<>grave<.>dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=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 :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -60,6 +61,8 @@ exit /b
set "blank=" set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" 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 :: Check if Null service is working, it's important for the batch script
@ -69,7 +72,7 @@ echo:
echo Null service is not running, script may crash... echo Null service is not running, script may crash...
echo: echo:
echo: echo:
echo Help - %mas%fix_service echo Check this webpage for help - %mas%fix_service
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 ping 127.0.0.1 -n 20
@ -84,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 Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
echo: echo:
echo Help - %mas%troubleshoot echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
@ -122,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% %nceline%
echo Unsupported OS version detected [%winbuild%]. 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 goto done2
) )
@ -161,33 +201,6 @@ goto done2
::======================================================================================================================================== ::========================================================================================================================================
:: Check PowerShell
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) || (
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 :: Elevate script as admin and pass arguments and preventing loop
%nul1% fltmc || ( %nul1% fltmc || (
@ -200,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 :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
if %winbuild% GEQ 17763 ( if %winbuild% GEQ 17763 (
@ -210,34 +303,35 @@ set terminal=
:: Check if script is running in Terminal app :: 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 ( 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 defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
:: 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 ( if defined terminal (
set "launchcmd=start conhost.exe %psc%" start conhost.exe "!_batf!" %_args% -qedit
) else ( start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
set "launchcmd=%psc%" 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 :skipQE
::======================================================================================================================================== ::========================================================================================================================================
@ -246,9 +340,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -= set -=
set old= set old=
set pingp=
set upver=%masver:.=%
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do ( for %%A in (
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1)) 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 ( if defined old (
@ -264,7 +368,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem 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)
) )
) )
@ -305,6 +409,7 @@ set HWID_Activation.cmd=Activators\HWID_Activation.cmd
set KMS38_Activation.cmd=Activators\KMS38_Activation.cmd set KMS38_Activation.cmd=Activators\KMS38_Activation.cmd
set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd
set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
set TSforge_Activation.cmd=Activators\TSforge_Activation.cmd
pushd "!_work!" pushd "!_work!"
set _nofile= set _nofile=
@ -313,6 +418,7 @@ for %%# in (
%KMS38_Activation.cmd% %KMS38_Activation.cmd%
%Online_KMS_Activation.cmd% %Online_KMS_Activation.cmd%
%Ohook_Activation_AIO.cmd% %Ohook_Activation_AIO.cmd%
%TSforge_Activation.cmd%
) do ( ) do (
if not exist "%%#" set _nofile=1 if not exist "%%#" set _nofile=1
) )
@ -338,36 +444,34 @@ echo:
echo: echo:
echo: echo:
echo: Extract $OEM$ folder on the desktop echo: Extract $OEM$ folder on the desktop
echo: ________________________________________________________ echo: ____________________________________________________________
echo: echo:
echo: [1] HWID echo: [1] HWID [Windows]
echo: [2] Ohook echo: [2] Ohook [Office]
echo: [3] KMS38 echo: [3] TSforge [Windows / ESU / Office]
echo: [4] Online KMS echo: [4] KMS38 [Windows]
echo: [5] Online KMS [Windows / Office]
echo: echo:
echo: [5] HWID ^(Windows^) ^+ Ohook ^(Office^) echo: [6] HWID [Windows] ^+ Ohook [Office]
echo: [6] HWID ^(Windows^) ^+ Online KMS ^(Office^) echo: [7] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^) echo: [8] TSforge [Windows] ^+ Online KMS [Office]
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
echo: echo:
call :dk_color2 %_White% " [R] " %_Green% "ReadMe" call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Exit echo: [0] Exit
echo: ________________________________________________________ echo: ____________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :" call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
choice /C:123456789R0 /N choice /C:12345678R0 /N
set _erl=%errorlevel% set _erl=%errorlevel%
if %_erl%==11 exit /b if %_erl%==10 exit /b
if %_erl%==10 start %mas%oem-folder &goto :Menu if %_erl%==9 start %mas%oem-folder &goto :Menu
if %_erl%==9 goto:kms_ohook if %_erl%==8 goto:tsforge_kms
if %_erl%==8 goto:kms38_kms if %_erl%==7 goto:hwid_ohook_tsforge
if %_erl%==7 goto:kms38_ohook if %_erl%==6 goto:hwid_ohook
if %_erl%==6 goto:hwid_kms if %_erl%==5 goto:kms
if %_erl%==5 goto:hwid_ohook if %_erl%==4 goto:kms38
if %_erl%==4 goto:kms if %_erl%==3 goto:tsforge
if %_erl%==3 goto:kms38
if %_erl%==2 goto:ohook if %_erl%==2 goto:ohook
if %_erl%==1 goto:hwid if %_erl%==1 goto:hwid
goto :Menu goto :Menu
@ -434,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 :kms38
cls cls
@ -532,26 +666,28 @@ cd \
::======================================================================================================================================== ::========================================================================================================================================
:hwid_kms :hwid_ohook_tsforge
cls cls
md "!desktop!\$OEM$\$$\Setup\Scripts" md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!" pushd "!_work!"
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul% 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 popd
call :export hwid_kms_setup call :export hwid_ohook_tsforge_setup
set _error= set _error=
if not exist "!_dir!\HWID_Activation.cmd" set _error=1 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 not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound if defined _error goto errorfound
set oem=HWID [Windows] + Online KMS [Office] set oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]
goto done goto done
:hwid_kms_setup: :hwid_ohook_tsforge_setup:
@echo off @echo off
fltmc >nul || exit /b fltmc >nul || exit /b
@ -560,80 +696,46 @@ setlocal
call "%~dp0HWID_Activation.cmd" /HWID call "%~dp0HWID_Activation.cmd" /HWID
endlocal 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 setlocal
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
endlocal endlocal
setlocal
call "%~dp0TSforge_Activation.cmd" /Z-ESU
endlocal
cd \ cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0") (goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:kms38_ohook_setup: :hwid_ohook_tsforge_setup:
::======================================================================================================================================== ::========================================================================================================================================
:kms38_kms :tsforge_kms
cls cls
md "!desktop!\$OEM$\$$\Setup\Scripts" md "!desktop!\$OEM$\$$\Setup\Scripts"
pushd "!_work!" 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% copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
popd popd
call :export kms38_kms_setup call :export tsforge_kms_setup
set _error= 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!\Online_KMS_Activation.cmd" set _error=1
if not exist "!_dir!\SetupComplete.cmd" set _error=1 if not exist "!_dir!\SetupComplete.cmd" set _error=1
if defined _error goto errorfound if defined _error goto errorfound
set oem=KMS38 [Windows] + Online KMS [Office] set oem=TSforge [Windows] + Online KMS [Office]
goto done goto done
:kms38_kms_setup: :tsforge_kms_setup:
@echo off @echo off
fltmc >nul || exit /b fltmc >nul || exit /b
setlocal setlocal
call "%~dp0KMS38_Activation.cmd" /KMS38 call "%~dp0TSforge_Activation.cmd" /Z-Windows
endlocal endlocal
setlocal setlocal
@ -642,45 +744,7 @@ endlocal
cd \ cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0") (goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
:kms38_kms_setup: :tsforge_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:
::======================================================================================================================================== ::========================================================================================================================================
@ -698,7 +762,7 @@ call :dk_color %Blue% "%oem%"
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop." call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
echo "%oem%" | find /i "38" %nul% && ( echo "%oem%" | find /i "38" %nul% && (
echo: 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 Check this page %mas%oem-folder
) )
echo ______________________________________________________________ echo ______________________________________________________________
@ -710,7 +774,8 @@ if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " 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" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
@ -728,9 +793,15 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c
set winbuild=1 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 set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 if %winbuild% LSS 10586 set _NCS=0
@ -778,7 +849,7 @@ exit /b
:export :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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -787,8 +858,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[0m echo %esc%[%~1%~2%esc%[0m
) else ( ) else if exist %ps% (
%psc% write-host -back '%1' -fore '%2' '%3' %psc% write-host -back '%1' -fore '%2' '%3'
) else if not exist %ps% (
echo %~3
) )
exit /b exit /b
@ -796,8 +869,10 @@ exit /b
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m 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' %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 exit /b

View File

@ -1,11 +1,11 @@
@set masver=2.9 @set masver=3.5
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: Homepage: mass grave[.]dev :: Homepage: mass<>grave<.>dev
:: Email: mas.help@outlook.com :: Email: mas.help@outlook.com
:: ::
::============================================================================ ::============================================================================
@ -37,6 +37,7 @@ set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=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 :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
@ -60,6 +61,8 @@ exit /b
set "blank=" set "blank="
set "mas=ht%blank%tps%blank%://mass%blank%grave.dev/" 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 :: Check if Null service is working, it's important for the batch script
@ -69,7 +72,7 @@ echo:
echo Null service is not running, script may crash... echo Null service is not running, script may crash...
echo: echo:
echo: echo:
echo Help - %mas%fix_service echo Check this webpage for help - %mas%fix_service
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 ping 127.0.0.1 -n 20
@ -84,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 Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
echo: echo:
echo Help - %mas%troubleshoot echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
@ -123,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% %nceline%
echo Unsupported OS version detected [%winbuild%]. 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 goto dk_done
) )
@ -162,33 +202,6 @@ goto dk_done
::======================================================================================================================================== ::========================================================================================================================================
:: Check PowerShell
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
echo:
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) || (
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 :: Elevate script as admin and pass arguments and preventing loop
%nul1% fltmc || ( %nul1% fltmc || (
@ -201,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 :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
if %winbuild% GEQ 17763 ( if %winbuild% GEQ 17763 (
@ -211,34 +304,35 @@ set terminal=
:: Check if script is running in Terminal app :: 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 ( 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 defined ps32onArm goto :skipQE
if %_unattended%==1 goto :skipQE if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
:: 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 ( if defined terminal (
set "launchcmd=start conhost.exe %psc%" start conhost.exe "!_batf!" %_args% -qedit
) else ( start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
set "launchcmd=%psc%" 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 :skipQE
::======================================================================================================================================== ::========================================================================================================================================
@ -247,9 +341,19 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
set -= set -=
set old= set old=
set pingp=
set upver=%masver:.=%
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do ( for %%A in (
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1)) 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 ( if defined old (
@ -265,7 +369,7 @@ echo:
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :" call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem 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)
) )
) )
@ -326,7 +430,7 @@ if %_erl%==5 goto:retokens
if %_erl%==4 goto:fixwmi if %_erl%==4 goto:fixwmi
if %_erl%==3 goto:sfcscan if %_erl%==3 goto:sfcscan
if %_erl%==2 goto:dism_rest 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 goto :at_menu
::======================================================================================================================================== ::========================================================================================================================================
@ -471,6 +575,13 @@ mode 125, 32
) )
title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^) 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:
echo %line% echo %line%
echo: echo:
@ -487,7 +598,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses.
echo - Fix permissions of SPP tokens folder and registries. echo - Fix permissions of SPP tokens folder and registries.
echo - Trigger the repair option for Office. echo - Trigger the repair option for Office.
echo: 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:
echo %line% echo %line%
echo: echo:
@ -613,6 +724,25 @@ echo:
call :dk_color %Blue% "Rebuilding SPP licensing tokens..." call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
echo: 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 call :scandat check
if not defined token ( if not defined token (
@ -638,7 +768,7 @@ echo Checking SPP permission related issues...
call :checkperms call :checkperms
if defined permerror ( if defined permerror (
call :dk_color %Red% "[!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 call :checkperms
if defined permerror ( if defined permerror (
call :dk_color %Red% "[!permerror!] [Failed To Fix]" call :dk_color %Red% "[!permerror!] [Failed To Fix]"
@ -651,21 +781,21 @@ echo [No Error Found]
) )
echo: echo:
echo Stopping sppsvc service... echo Stopping %_slser% service...
%psc% Stop-Service sppsvc -force %nul% %psc% Stop-Service %_slser% -force %nul%
set w= set w=
set _sppint= 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 ( if defined _sppint (
echo: echo:
echo Removing SPP IFEO registry keys... 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 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:
echo Checking Update KB971033... echo Checking Update KB971033...
%psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul% %psc% "if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3}" %nul%
@ -682,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 :: Delete registry keys that are not deleted by activation scripts
if not defined _vis (
echo: echo:
echo Cleaning some licensing-related registry keys... echo Cleaning some licensing-related registry keys...
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f
@ -689,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 "PolicyValuesArray" /f
%nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f
%nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f
)
echo: echo:
call :scandat delete call :scandat delete
@ -700,10 +832,14 @@ call :dk_color %Red% "Failed to delete .dat files."
echo: echo:
) )
if defined _vis (
%psc% Start-Service %_slser% %nul%
)
echo: echo:
echo Reinstalling system licenses... 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% %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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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 ( if %errorlevel% EQU 0 (
echo [Successful] echo [Successful]
) else ( ) else (
@ -719,7 +855,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file."
echo tokens.dat file was rebuilt successfully. echo tokens.dat file was rebuilt successfully.
) )
if %winbuild% LSS 9200 ( if %winbuild% LSS 9200 if not defined _vis (
sc config sppuinotify start= demand sc config sppuinotify start= demand
) )
@ -800,12 +936,12 @@ 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 %_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=") 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 %_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\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 %_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\EntityPicker.dll" (set "msi15_86=Office 15.0 MSI x86" & call :getrepairsetup msi15repair86 15) 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\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 %_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\EntityPicker.dll" (set "msi16_86=Office 16.0 MSI x86" & call :getrepairsetup msi16repair86 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*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\EntityPicker.dll" (set "msi16_68=Office 16.0 MSI x86/x64" & call :getrepairsetup msi16repair68 16) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\*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" & call :getc2rrepair c2r15repair86 integratedoffice.exe) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & 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 %_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)
@ -1104,7 +1240,7 @@ goto :at_menu
:: https://stackoverflow.com/a/46268232 :: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\ddf"" set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%""
%nul% del /q /f %ddf% %nul% del /q /f %ddf%
echo/.New Cabinet>%ddf% echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf% echo/.set Cabinet=ON>>%ddf%
@ -1156,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 ( if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
@ -1170,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 :: Fix SPP related registry and folder permissions
:fixsppperms: :fixsppperms:
@ -1202,7 +1391,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
} }
# Fix perms for SPP in HKU\S-1-5-20 # 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') { if ($env:permerror -ne 'Error Found In S-1-5-20 SPP') {
exit exit
@ -1285,13 +1474,13 @@ function InstallLicenseArr($Str) {
ForEach ($x in $a) {InstallLicenseFile "$x"} ForEach ($x in $a) {InstallLicenseFile "$x"}
} }
function InstallLicenseDir($Loc) { 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() { function ReinstallLicenses() {
$Oem = "$env:SysPath\oem" $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens")
$Spp = "$env:SysPath\spp\tokens" foreach ($Path in $Paths) {
InstallLicenseDir "$Spp" if (Test-Path $Path) { InstallLicenseDir "$Path" }
If (Test-Path $Oem) {InstallLicenseDir "$Oem"} }
} }
:xrm: :xrm:
@ -1305,6 +1494,7 @@ for %%# in (
%SysPath%\spp\store\ %SysPath%\spp\store\
%SysPath%\spp\store\2.0\ %SysPath%\spp\store\2.0\
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\ %Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\
) do ( ) do (
if %1==check ( if %1==check (
@ -1348,7 +1538,7 @@ exit /b
:regownstart :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 exit /b
:: Below code takes ownership of a volatile registry key and deletes it :: Below code takes ownership of a volatile registry key and deletes it
@ -1380,14 +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 :dk_done
echo: echo:
if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " 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" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#)) if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
) )
if defined terminal ( if defined terminal (
@ -1397,26 +1644,7 @@ choice /c 0 /n
call :dk_color %_Yellow% "Press any key to %_exitmsg%..." call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
pause %nul1% 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 exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -1425,9 +1653,15 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
set psc=%ps% -nop -c
set winbuild=1 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 set _NCS=1
if %winbuild% LSS 10586 set _NCS=0 if %winbuild% LSS 10586 set _NCS=0

239
README.md
View File

@ -1,108 +1,131 @@
<p align="center"><img src="https://massgrave.dev/img/logo_small.png" alt="MAS Logo"></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> <h1 align="center">Microsoft Activation Scripts (MAS)</h1>
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p> <p align="center">Open-source Windows and Office activator featuring HWID, Ohook, TSforge, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
<hr> <hr>
## Download / How to use it? ## How to Activate Windows / Office / Extended Updates (ESU)?
### Method 1 - PowerShell (Windows 8 and later) ❤️ ### Method 1 - PowerShell ❤️
1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal. 1. **Open PowerShell**
2. Copy and paste the code below and press enter Click the **Start Menu**, type `PowerShell`, then open it.
```
irm https://get.activated.win | iex 2. **Copy and paste the code below, then press enter.**
``` - For **Windows 8, 10, 11**: 📌
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation. ```
4. That's all. irm https://get.activated.win | iex
```
<details> - For **Windows 7** and later:
<summary>More options</summary> ```
iex ((New-Object Net.WebClient).DownloadString('https://get.activated.win'))
- Alternatively, you can use the following (It will be deprecated in the future.) ```
```
irm https://massgrave.dev/get | iex <details>
```
- The URL `get.activated.win` might be blocked by some DNS services because it is a new domain. <summary>Script not launching❓Click here for info.</summary>
</details> ---
--- - If the above is blocked (by ISP/DNS), try this (needs **updated Windows 10 or 11**):
```
### Method 2 - Traditional (Windows 7 and later) iex (curl.exe -s --doh-url https://1.1.1.1/dns-query https://get.activated.win | Out-String)
```
<details> - If that fails or you have an older Windows, use the below-listed Method 2.
<summary>Click here for info</summary>
---
1. Download the file using the links provided below.
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip` </details>
or
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip` 3. The activation menu will appear. **Choose the green-highlighted options** to activate Windows or Office.
2. Right-click on the downloaded zip file and extract
3. In the extracted folder, find the folder named `All-In-One-Version` 4. **Done!**
4. Run the file named `MAS_AIO.cmd`
5. You will see the activation options, follow the on-screen instructions. ---
6. That's all.
### Method 2 - Traditional (Windows Vista and later)
</details>
<details>
--- <summary>Click here to view</summary>
> [!NOTE] 1. Download the file using one of the links below:
> `https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it. or
> - Always double-check the URL before executing the command and verify the source if manually downloading files. `https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command. 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.
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches). 6. That's all.
``` </details>
Latest Version: 2.9
Release date: 20-Dec-2024 ---
```
> [!TIP]
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot) > - 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.
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media) > - **Having trouble**❓Visit our [troubleshooting page](https://massgrave.dev/troubleshoot) or raise an issue on [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts/issues).
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
---
<div align="center">
- To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
[![1.1]][1] - To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
[![1.2]][2]
[![1.3]][3] ---
</div> > [!NOTE]
>
<div align="center"> > - 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.
[![1.4]][4] > - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
[![1.5]][5]
[![1.6]][6] ---
[![1.7]][7]
```
</div> Latest Version: 3.5
Release date: 10-Aug-2025
[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) ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
[1.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup) ### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit)
[1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky) <div align="center">
[1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
[![1.1]][1]
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts [![1.2]][2]
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts [![1.3]][3]
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
[4]: https://discord.gg/j2yFsV5ZVC </div>
[5]: https://www.reddit.com/r/MAS_Activator
[6]: https://bsky.app/profile/massgrave.dev <div align="center">
[7]: https://twitter.com/massgravel
[![1.4]][4]
--- [![1.5]][5]
[![1.6]][6]
<p align="center">Made with Love ❤️</p> [![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>