mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-01-29 09:19:00 +01:00
Add Run_GUI.cmd to launch the MAS_GUI PowerShell script
This commit is contained in:
parent
31a79148b1
commit
135aa20d5a
14 changed files with 25183 additions and 46245 deletions
3398
App/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
Normal file
3398
App/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
Normal file
File diff suppressed because it is too large
Load diff
4254
App/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
Normal file
4254
App/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
Normal file
File diff suppressed because it is too large
Load diff
9815
App/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
9815
App/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
Normal file
File diff suppressed because it is too large
Load diff
13
App/MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
13
App/MAS/Separate-Files-Version/Activators/_ReadMe.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
--------------------------------------------------------------------------------------
|
||||
Activation Type Supported Product Activation Period
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
HWID - Windows 10-11 - Permanent
|
||||
Ohook - Office - Permanent
|
||||
TSforge - Windows / ESU / Office - Permanent
|
||||
Online KMS - Windows / Office - 180 Days. Lifetime With Renewal Task
|
||||
|
||||
--------------------------------------------------------------------------------------
|
||||
|
||||
Check the below link for more details:
|
||||
https://massgrave.dev/chart
|
||||
1689
App/MAS/Separate-Files-Version/Change_Office_Edition.cmd
Normal file
1689
App/MAS/Separate-Files-Version/Change_Office_Edition.cmd
Normal file
File diff suppressed because it is too large
Load diff
1464
App/MAS/Separate-Files-Version/Change_Windows_Edition.cmd
Normal file
1464
App/MAS/Separate-Files-Version/Change_Windows_Edition.cmd
Normal file
File diff suppressed because it is too large
Load diff
1584
App/MAS/Separate-Files-Version/Check_Activation_Status.cmd
Normal file
1584
App/MAS/Separate-Files-Version/Check_Activation_Status.cmd
Normal file
File diff suppressed because it is too large
Load diff
840
App/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd
Normal file
840
App/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd
Normal file
|
|
@ -0,0 +1,840 @@
|
|||
@set masver=3.9
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
::============================================================================
|
||||
::
|
||||
:: Homepage: m{}assgrave{dot}dev
|
||||
::
|
||||
::============================================================================
|
||||
|
||||
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set environment variables, it helps if they are misconfigured in the system
|
||||
|
||||
setlocal EnableExtensions
|
||||
setlocal DisableDelayedExpansion
|
||||
|
||||
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
|
||||
|
||||
set "SysPath=%SystemRoot%\System32"
|
||||
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||
set "SysPath=%SystemRoot%\Sysnative"
|
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||
)
|
||||
|
||||
set "ComSpec=%SysPath%\cmd.exe"
|
||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||
|
||||
set re1=
|
||||
set re2=
|
||||
set "_cmdf=%~f0"
|
||||
for %%# in (%*) do (
|
||||
if /i "%%#"=="re1" set re1=1
|
||||
if /i "%%#"=="re2" set re2=1
|
||||
if /i "%%#"=="-qedit" (set re1=1&set re2=1)
|
||||
)
|
||||
|
||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||
|
||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||
setlocal EnableDelayedExpansion
|
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||
exit /b
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
set "blank="
|
||||
set "mas=ht%blank%tps%blank%://m%blank%ass%blank%grave.dev/"
|
||||
set "github=ht%blank%tps%blank%://github.com/m%blank%assgra%blank%vel/Micro%blank%soft-Acti%blank%vation-Scripts"
|
||||
set "selfgit=ht%blank%tps%blank%://git.acti%blank%vated.win/Micr%blank%osoft-Act%blank%ivation-Scripts"
|
||||
|
||||
:: Check if Null service is working, it's important for the batch script
|
||||
|
||||
sc query Null | find /i "RUNNING"
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo:
|
||||
echo Null service is not running, script may crash...
|
||||
echo:
|
||||
echo:
|
||||
echo Check this webpage for help - %mas%fix_service
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20
|
||||
)
|
||||
cls
|
||||
|
||||
:: Check LF line ending
|
||||
|
||||
pushd "%~dp0"
|
||||
>nul findstr /v "$" "%~nx0" && (
|
||||
echo:
|
||||
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||
echo:
|
||||
echo:
|
||||
echo Check this webpage for help - %mas%troubleshoot
|
||||
echo:
|
||||
echo:
|
||||
ping 127.0.0.1 -n 20 >nul
|
||||
popd
|
||||
exit /b
|
||||
)
|
||||
popd
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
cls
|
||||
color 07
|
||||
title Extract $OEM$ Folder %masver%
|
||||
|
||||
set _args=
|
||||
set _elev=
|
||||
set _unattended=0
|
||||
|
||||
set _args=%*
|
||||
if defined _args set _args=%_args:"=%
|
||||
if defined _args set _args=%_args:re1=%
|
||||
if defined _args set _args=%_args:re2=%
|
||||
if defined _args (
|
||||
for %%A in (%_args%) do (
|
||||
if /i "%%A"=="-el" set _elev=1
|
||||
)
|
||||
)
|
||||
|
||||
set "nul1=1>nul"
|
||||
set "nul2=2>nul"
|
||||
set "nul6=2^>nul"
|
||||
set "nul=>nul 2>&1"
|
||||
|
||||
call :dk_setvar
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if %winbuild% EQU 1 (
|
||||
%eline%
|
||||
echo Failed to detect Windows build number.
|
||||
echo:
|
||||
setlocal EnableDelayedExpansion
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto done2
|
||||
)
|
||||
|
||||
if exist "%Systemdrive%\Users\WDAGUtilityAccount" (
|
||||
sc query gcs | find /i "RUNNING" %nul% && (
|
||||
%eline%
|
||||
echo Windows Sandbox detected.
|
||||
echo The script cannot run due to missing licensing components. Aborting...
|
||||
echo:
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
if %winbuild% LSS 6001 (
|
||||
%nceline%
|
||||
echo Unsupported OS version detected [%winbuild%].
|
||||
echo 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
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Fix special character limitations in path name
|
||||
|
||||
set "_work=%~dp0"
|
||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||
|
||||
set "_batf=%~f0"
|
||||
set "_batp=%_batf:'=''%"
|
||||
|
||||
set _PSarg="""%~f0""" -el %_args%
|
||||
set _PSarg=%_PSarg:'=''%
|
||||
|
||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||
if /i not "!_work!"=="!_ttemp!" (
|
||||
%eline%
|
||||
echo The script was launched from the temp folder.
|
||||
echo You are most likely running the script directly from the archive file.
|
||||
echo:
|
||||
echo Extract the archive file and launch the script from the extracted folder.
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Elevate script as admin and pass arguments and preventing loop
|
||||
|
||||
%nul1% fltmc || (
|
||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||
%eline%
|
||||
echo This script needs admin rights.
|
||||
echo Right click on this script and select 'Run as administrator'.
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check PowerShell
|
||||
|
||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||
|
||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a)
|
||||
|
||||
if /i not "%tstresult%"=="FullLanguage" (
|
||||
%eline%
|
||||
for /f "delims=" %%a in ('%psc% "$ExecutionContext.SessionState.LanguageMode" %nul6%') do (set tstresult2=%%a)
|
||||
echo Test 1 - %tstresult%
|
||||
echo Test 2 - !tstresult2!
|
||||
echo:
|
||||
|
||||
REM check LanguageMode
|
||||
|
||||
echo: !tstresult2! | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||
echo If you have applied restrictions on Powershell then undo those changes.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%fix_powershell
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check Powershell core version
|
||||
|
||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check for Mal-ware that may cause issues with Powershell
|
||||
|
||||
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||
echo "%%f"
|
||||
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||
echo:
|
||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||
goto done2
|
||||
)
|
||||
|
||||
REM check if .NET is working properly
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
cmd /c "%psc% ""try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3}""" %nul%
|
||||
if !errorlevel!==3 (
|
||||
echo Windows Powershell failed to load .NET command. Aborting...
|
||||
echo:
|
||||
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||
goto done2
|
||||
)
|
||||
)
|
||||
|
||||
REM check antivirus and other errors
|
||||
|
||||
echo PowerShell is not working properly. Aborting...
|
||||
|
||||
if /i "!tstresult2!"=="FullLanguage" (
|
||||
echo:
|
||||
echo Your antivirus software might be blocking the script.
|
||||
echo:
|
||||
sc query sense | find /i "RUNNING" %nul% && (
|
||||
echo Installed Antivirus - Microsoft Defender for Endpoint
|
||||
)
|
||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}"""
|
||||
)
|
||||
|
||||
echo:
|
||||
set fixes=%fixes% %mas%troubleshoot
|
||||
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||
|
||||
if %winbuild% GEQ 17763 (
|
||||
set terminal=1
|
||||
) else (
|
||||
set terminal=
|
||||
)
|
||||
|
||||
:: Check if script is running in Terminal app
|
||||
|
||||
if defined terminal (
|
||||
set lines=0
|
||||
for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" (
|
||||
for %%B in (%%A) do set lines=%%B
|
||||
)
|
||||
if !lines! GEQ 100 set terminal=
|
||||
)
|
||||
|
||||
if %_unattended%==1 goto :skipQE
|
||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||
|
||||
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||
|
||||
set resetQE=1
|
||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||
|
||||
if defined terminal (
|
||||
start conhost.exe "!_batf!" %_args% -qedit
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
) else if %resetQE% EQU 1 (
|
||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||
exit /b
|
||||
)
|
||||
|
||||
:skipQE
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check for updates
|
||||
|
||||
set -=
|
||||
set old=
|
||||
set pingp=
|
||||
set upver=%masver:.=%
|
||||
|
||||
for %%A in (
|
||||
activ%-%ated.win
|
||||
mass%-%grave.dev
|
||||
) do if not defined pingp (
|
||||
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||
if not "%%B"=="" (set old=1& set pingp=1)
|
||||
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||
if not "%%C"=="" set old=
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if defined old (
|
||||
echo ________________________________________________
|
||||
%eline%
|
||||
echo Your version of MAS [%masver%] is outdated.
|
||||
echo ________________________________________________
|
||||
echo:
|
||||
if not %_unattended%==1 (
|
||||
echo [1] Get Latest MAS
|
||||
echo [0] Continue Anyway
|
||||
echo:
|
||||
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||
choice /C:10 /N
|
||||
if !errorlevel!==2 rem
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & start %mas% & exit /b)
|
||||
)
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
setlocal DisableDelayedExpansion
|
||||
|
||||
:: Check desktop location
|
||||
|
||||
set desktop=
|
||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "desktop=%%b"
|
||||
if not defined desktop for /f "delims=" %%a in ('%psc% "& {write-host $([Environment]::GetFolderPath('Desktop'))}"') do call set "desktop=%%a"
|
||||
|
||||
set "_pdesk=%desktop:'=''%"
|
||||
set "_dir=%desktop%\$OEM$\$$\Setup\Scripts"
|
||||
|
||||
if exist "!desktop!\" (
|
||||
%eline%
|
||||
echo Unable to detect Desktop location, aborting...
|
||||
goto done2
|
||||
)
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
if not defined terminal mode 78, 30
|
||||
|
||||
if exist "!desktop!\$OEM$\" (
|
||||
echo _____________________________________________________
|
||||
%eline%
|
||||
echo The $OEM$ folder already exists on your Desktop.
|
||||
echo _____________________________________________________
|
||||
goto done2
|
||||
)
|
||||
|
||||
set HWID_Activation.cmd=Activators\HWID_Activation.cmd
|
||||
set Online_KMS_Activation.cmd=Activators\Online_KMS_Activation.cmd
|
||||
set Ohook_Activation_AIO.cmd=Activators\Ohook_Activation_AIO.cmd
|
||||
set TSforge_Activation.cmd=Activators\TSforge_Activation.cmd
|
||||
pushd "!_work!"
|
||||
|
||||
set _nofile=
|
||||
for %%# in (
|
||||
%HWID_Activation.cmd%
|
||||
%Online_KMS_Activation.cmd%
|
||||
%Ohook_Activation_AIO.cmd%
|
||||
%TSforge_Activation.cmd%
|
||||
) do (
|
||||
if not exist "%%#" set _nofile=1
|
||||
)
|
||||
|
||||
popd
|
||||
|
||||
if defined _nofile (
|
||||
echo _____________________________________________________
|
||||
%eline%
|
||||
echo Some files are missing in the 'Activators' folder.
|
||||
echo _____________________________________________________
|
||||
goto done2
|
||||
)
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:Menu
|
||||
|
||||
cls
|
||||
if not defined terminal mode 78, 30
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
echo:
|
||||
echo: Extract $OEM$ folder on the desktop
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
echo: [1] HWID [Windows]
|
||||
echo: [2] Ohook [Office]
|
||||
echo: [3] TSforge [Windows / ESU / Office]
|
||||
echo: [4] Online KMS [Windows / Office]
|
||||
echo:
|
||||
echo: [5] HWID [Windows] ^+ Ohook [Office]
|
||||
echo: [6] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
|
||||
echo: [7] TSforge [Windows / ESU] ^+ Ohook [Office]
|
||||
echo:
|
||||
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||
echo: [0] Exit
|
||||
echo: ____________________________________________________________
|
||||
echo:
|
||||
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
|
||||
choice /C:1234567R0 /N
|
||||
set _erl=%errorlevel%
|
||||
|
||||
if %_erl%==9 exit /b
|
||||
if %_erl%==8 start %mas%oem-folder &goto :Menu
|
||||
if %_erl%==7 goto:tsforge_ohook
|
||||
if %_erl%==6 goto:hwid_ohook_tsforge
|
||||
if %_erl%==5 goto:hwid_ohook
|
||||
if %_erl%==4 goto:kms
|
||||
if %_erl%==3 goto:tsforge
|
||||
if %_erl%==2 goto:ohook
|
||||
if %_erl%==1 goto:hwid
|
||||
goto :Menu
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:hwid
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export hwid_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=HWID
|
||||
goto done
|
||||
|
||||
:hwid_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0HWID_Activation.cmd" /HWID
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:hwid_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b %Ohook_Activation_AIO.cmd% "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export ohook_setup
|
||||
|
||||
set _error=
|
||||
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=Ohook
|
||||
goto done
|
||||
|
||||
:ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:ohook_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
: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:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:kms
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%Online_KMS_Activation.cmd%" "!_dir!\Online_KMS_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export kms_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\Online_KMS_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=Online KMS
|
||||
goto done
|
||||
|
||||
:kms_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
call "%~dp0Online_KMS_Activation.cmd" /K-WindowsOffice
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:kms_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:hwid_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export hwid_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\HWID_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=HWID [Windows] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:hwid_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0HWID_Activation.cmd" /HWID
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:hwid_ohook_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:hwid_ohook_tsforge
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%HWID_Activation.cmd%" "!_dir!\HWID_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
popd
|
||||
call :export hwid_ohook_tsforge_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\HWID_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\Ohook_Activation_AIO.cmd" set _error=1
|
||||
if not exist "!_dir!\TSforge_Activation.cmd" set _error=1
|
||||
if not exist "!_dir!\SetupComplete.cmd" set _error=1
|
||||
if defined _error goto errorfound
|
||||
|
||||
set oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]
|
||||
goto done
|
||||
|
||||
:hwid_ohook_tsforge_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0HWID_Activation.cmd" /HWID
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-ESU
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:hwid_ohook_tsforge_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:tsforge_ohook
|
||||
|
||||
cls
|
||||
md "!desktop!\$OEM$\$$\Setup\Scripts"
|
||||
pushd "!_work!"
|
||||
copy /y /b "%TSforge_Activation.cmd%" "!_dir!\TSforge_Activation.cmd" %nul%
|
||||
copy /y /b "%Ohook_Activation_AIO.cmd%" "!_dir!\Ohook_Activation_AIO.cmd" %nul%
|
||||
popd
|
||||
call :export tsforge_ohook_setup
|
||||
|
||||
set _error=
|
||||
if not exist "!_dir!\TSforge_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=TSforge [Windows / ESU] + Ohook [Office]
|
||||
goto done
|
||||
|
||||
:tsforge_ohook_setup:
|
||||
@echo off
|
||||
|
||||
fltmc >nul || exit /b
|
||||
|
||||
setlocal
|
||||
call "%~dp0TSforge_Activation.cmd" /Z-Windows /Z-ESU
|
||||
endlocal
|
||||
|
||||
setlocal
|
||||
call "%~dp0Ohook_Activation_AIO.cmd" /Ohook
|
||||
endlocal
|
||||
|
||||
cd \
|
||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||
:tsforge_ohook_setup:
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:errorfound
|
||||
|
||||
%eline%
|
||||
echo The script failed to create the $OEM$ folder.
|
||||
goto :done2
|
||||
|
||||
:done
|
||||
|
||||
echo ______________________________________________________________
|
||||
echo:
|
||||
call :dk_color %Blue% "%oem%"
|
||||
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
|
||||
echo ______________________________________________________________
|
||||
|
||||
:done2
|
||||
|
||||
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 exit /b
|
||||
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
|
||||
)
|
||||
|
||||
if defined terminal (
|
||||
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
|
||||
choice /c 0 /n
|
||||
) else (
|
||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||
pause %nul1%
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Set variables
|
||||
|
||||
:dk_setvar
|
||||
|
||||
set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe
|
||||
set psc=%ps% -nop -c
|
||||
set winbuild=1
|
||||
for /f "tokens=2 delims=[]" %%G in ('ver') do for /f "tokens=2,3,4 delims=. " %%H in ("%%~G") do set "winbuild=%%J"
|
||||
|
||||
set _slexe=sppsvc.exe& set _slser=sppsvc
|
||||
if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc)
|
||||
if %_slexe%==SLsvc.exe set _vis=1
|
||||
|
||||
set _NCS=1
|
||||
if %winbuild% LSS 10586 set _NCS=0
|
||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||
|
||||
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||
|
||||
if %_NCS% EQU 1 (
|
||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||
set "Red="41;97m""
|
||||
set "Gray="100;97m""
|
||||
set "Green="42;97m""
|
||||
set "Blue="44;97m""
|
||||
set "White="107;91m""
|
||||
set "_Red="40;91m""
|
||||
set "_White="40;37m""
|
||||
set "_Green="40;92m""
|
||||
set "_Yellow="40;93m""
|
||||
) else (
|
||||
set "Red="Red" "white""
|
||||
set "Gray="Darkgray" "white""
|
||||
set "Green="DarkGreen" "white""
|
||||
set "Blue="Blue" "white""
|
||||
set "White="White" "Red""
|
||||
set "_Red="Black" "Red""
|
||||
set "_White="Black" "Gray""
|
||||
set "_Green="Black" "Green""
|
||||
set "_Yellow="Black" "Yellow""
|
||||
)
|
||||
|
||||
set "nceline=echo: &echo ==== ERROR ==== &echo:"
|
||||
set "eline=echo: &call :dk_color %Red% "==== ERROR ====" &echo:"
|
||||
if %~z0 GEQ 200000 (
|
||||
set "_exitmsg=Go back"
|
||||
set "_fixmsg=Go back to Main Menu, select Troubleshoot and run Fix Licensing option."
|
||||
) else (
|
||||
set "_exitmsg=Exit"
|
||||
set "_fixmsg=In MAS folder, run Troubleshoot script and select Fix Licensing option."
|
||||
)
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Extract the text from batch script without character and file encoding issue
|
||||
|
||||
:export
|
||||
|
||||
%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
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
: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
|
||||
|
||||
::========================================================================================================================================
|
||||
:: Leave empty line below
|
||||
1745
App/MAS/Separate-Files-Version/Troubleshoot.cmd
Normal file
1745
App/MAS/Separate-Files-Version/Troubleshoot.cmd
Normal file
File diff suppressed because it is too large
Load diff
3
App/MAS/Separate-Files-Version/_ReadMe.html
Normal file
3
App/MAS/Separate-Files-Version/_ReadMe.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<html>
|
||||
<meta http-equiv="refresh" content="0; url=https://massgrave.dev/">
|
||||
</html>
|
||||
376
App/MAS_GUI.ps1
Normal file
376
App/MAS_GUI.ps1
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Win11 Style GUI for Microsoft Activation Scripts (MAS)
|
||||
.DESCRIPTION
|
||||
A modern, Fluent-inspired interface for MAS with auto-detection of system status.
|
||||
#>
|
||||
|
||||
# --- Self-Elevation ---
|
||||
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
||||
if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
$scriptPath = $MyInvocation.MyCommand.Path
|
||||
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" -Verb RunAs
|
||||
Exit
|
||||
}
|
||||
|
||||
# --- Assemblies ---
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
# --- Helper: Get System Info ---
|
||||
function Get-SystemInfo {
|
||||
try {
|
||||
$os = Get-CimInstance Win32_OperatingSystem
|
||||
$comp = Get-CimInstance Win32_ComputerSystem
|
||||
|
||||
$edition = $os.Caption -replace "Microsoft ", ""
|
||||
$version = $os.Version
|
||||
$build = $os.BuildNumber
|
||||
|
||||
# Simple Activation Check (Partial)
|
||||
# 1=Licensed
|
||||
$license = Get-CimInstance SoftwareLicensingProduct | Where-Object { $_.PartialProductKey -and $_.Name -like "Windows*" } | Select-Object -First 1
|
||||
$status = if ($license.LicenseStatus -eq 1) { "Permanently Activated" } else { "Not Activated / check details" }
|
||||
if ($license.LicenseStatus -eq 1 -and $license.GracePeriodRemaining -gt 0) { $status = "Volume/KMS Activated" }
|
||||
|
||||
return @{
|
||||
Edition = $edition
|
||||
Version = "Build $build"
|
||||
Status = $status
|
||||
PCName = $comp.Name
|
||||
}
|
||||
} catch {
|
||||
return @{ Edition = "Unknown"; Version = ""; Status = "Unknown"; PCName = "Unknown" }
|
||||
}
|
||||
}
|
||||
|
||||
$sysInfo = Get-SystemInfo
|
||||
|
||||
# --- XAML ---
|
||||
[xml]$xaml = @"
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Microsoft Activation Scripts" Height="600" Width="950"
|
||||
WindowStartupLocation="CenterScreen" ResizeMode="CanResize"
|
||||
Background="#202020" Foreground="#FFFFFF" FontFamily="Segoe UI Variable Display, Segoe UI, sans-serif">
|
||||
|
||||
<Window.Resources>
|
||||
<!-- Win11 Palette -->
|
||||
<SolidColorBrush x:Key="AppBackground" Color="#202020"/>
|
||||
<SolidColorBrush x:Key="NavBackground" Color="#191919"/>
|
||||
<SolidColorBrush x:Key="CardBackground" Color="#272727"/>
|
||||
<SolidColorBrush x:Key="CardBorder" Color="#353535"/>
|
||||
<SolidColorBrush x:Key="CardHover" Color="#323232"/>
|
||||
<SolidColorBrush x:Key="AccentColor" Color="#60CDFF"/>
|
||||
<SolidColorBrush x:Key="TextPrimary" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="TextSecondary" Color="#A0A0A0"/>
|
||||
|
||||
<!-- Win11 Button Style -->
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="{StaticResource CardBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource CardBorder}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="12,8"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="{StaticResource CardHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#303030"/>
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#505050"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Navigation RadioButton Style -->
|
||||
<!-- We use RadioButtons for tabs to simulate NavigationView properly -->
|
||||
<Style x:Key="NavButtonStyle" TargetType="RadioButton">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#D0D0D0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Margin" Value="5,2"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Active Indicator -->
|
||||
<Rectangle x:Name="indicator" Grid.Column="0" Fill="{StaticResource AccentColor}" Height="16" RadiusX="2" RadiusY="2" Visibility="Collapsed" Margin="0,0,0,0"/>
|
||||
|
||||
<ContentPresenter Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#2D2D2D"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#303030"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter TargetName="indicator" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Info Card Style -->
|
||||
<Style x:Key="InfoCard" TargetType="Border">
|
||||
<Setter Property="Background" Value="{StaticResource CardBackground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource CardBorder}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="8"/>
|
||||
<Setter Property="Padding" Value="20"/>
|
||||
<Setter Property="Margin" Value="0,0,0,15"/>
|
||||
</Style>
|
||||
|
||||
<!-- Action Card Style -->
|
||||
<Style x:Key="ActionCard" TargetType="Button">
|
||||
<Setter Property="Background" Value="{StaticResource CardBackground}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{StaticResource CardBorder}" BorderThickness="1" CornerRadius="8" Padding="20">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0" HorizontalAlignment="Left"/>
|
||||
<TextBlock Grid.Column="1" Text="" FontFamily="Segoe Fluent Icons, Segoe MDL2 Assets" FontSize="16" Foreground="{StaticResource AccentColor}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="{StaticResource CardHover}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="{StaticResource NavBackground}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Sidebar -->
|
||||
<StackPanel Grid.Column="0" Margin="10,20,10,20">
|
||||
<!-- App Title -->
|
||||
<StackPanel Orientation="Horizontal" Margin="15,0,0,30">
|
||||
<Border Width="24" Height="24" CornerRadius="12" Background="{StaticResource AccentColor}" Margin="0,0,10,0">
|
||||
<TextBlock Text="M" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Foreground="Black"/>
|
||||
</Border>
|
||||
<TextBlock Text="MAS" FontSize="18" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Nav Items -->
|
||||
<RadioButton x:Name="navHome" Content="System Overview" Style="{StaticResource NavButtonStyle}" IsChecked="True"/>
|
||||
<RadioButton x:Name="navActivators" Content="Activators" Style="{StaticResource NavButtonStyle}"/>
|
||||
<RadioButton x:Name="navExtras" Content="Troubleshoot & Extras" Style="{StaticResource NavButtonStyle}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<!-- Content Area -->
|
||||
<Border Grid.Column="1" Background="{StaticResource AppBackground}" CornerRadius="10,0,0,0" Padding="40,30">
|
||||
<Grid>
|
||||
<!-- Home View -->
|
||||
<StackPanel x:Name="viewHome" Visibility="Visible">
|
||||
<TextBlock Text="System Overview" FontSize="26" FontWeight="SemiBold" Margin="0,0,0,20"/>
|
||||
|
||||
<Border Style="{StaticResource InfoCard}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Windows Information" FontSize="14" FontWeight="SemiBold" Foreground="{StaticResource AccentColor}" Margin="0,0,0,10"/>
|
||||
<Grid Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe Fluent Icons, Segoe MDL2 Assets" FontSize="24" VerticalAlignment="Center" Margin="0,0,15,0" Foreground="{StaticResource TextSecondary}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="$($sysInfo.Edition)" FontSize="18" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="$($sysInfo.Version)" FontSize="14" Foreground="{StaticResource TextSecondary}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource InfoCard}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Activation Status" FontSize="14" FontWeight="SemiBold" Foreground="{StaticResource AccentColor}" Margin="0,0,0,10"/>
|
||||
<Grid Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe Fluent Icons, Segoe MDL2 Assets" FontSize="24" VerticalAlignment="Center" Margin="0,0,15,0" Foreground="{StaticResource TextSecondary}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="$($sysInfo.Status)" FontSize="18" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="This information is detected automatically." FontSize="14" Foreground="#666"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<TextBlock Text="Quick Actions" FontSize="16" FontWeight="SemiBold" Margin="0,20,0,10"/>
|
||||
<Button x:Name="btnHomeHWID" Style="{StaticResource ActionCard}" Margin="0,5">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Activate Windows" FontSize="16" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="Use HWID method (Recommended)" FontSize="13" Foreground="{StaticResource TextSecondary}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Activators View -->
|
||||
<StackPanel x:Name="viewActivators" Visibility="Collapsed">
|
||||
<TextBlock Text="Activation Methods" FontSize="26" FontWeight="SemiBold" Margin="0,0,0,20"/>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Hidden">
|
||||
<StackPanel>
|
||||
<!-- HWID -->
|
||||
<TextBlock Text="Windows 10 / 11" FontSize="14" Foreground="{StaticResource TextSecondary}" Margin="0,10,0,5"/>
|
||||
<Button x:Name="btnHWID" Style="{StaticResource ActionCard}" Margin="0,0,0,15">
|
||||
<StackPanel>
|
||||
<TextBlock Text="HWID Activation" FontSize="16" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="Permanent digital license. Does not require renewal." FontSize="13" Foreground="{StaticResource TextSecondary}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Ohook -->
|
||||
<TextBlock Text="Office" FontSize="14" Foreground="{StaticResource TextSecondary}" Margin="0,10,0,5"/>
|
||||
<Button x:Name="btnOhook" Style="{StaticResource ActionCard}" Margin="0,0,0,15">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Ohook Activation" FontSize="16" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="Permanent Office activation (2013-2024, 365)." FontSize="13" Foreground="{StaticResource TextSecondary}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- KMS -->
|
||||
<TextBlock Text="Volume / Enterprise" FontSize="14" Foreground="{StaticResource TextSecondary}" Margin="0,10,0,5"/>
|
||||
<Button x:Name="btnKMS" Style="{StaticResource ActionCard}" Margin="0,0,0,15">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Online KMS38" FontSize="16" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="Activates until 2038 or 180-days (Server/Enterprise)." FontSize="13" Foreground="{StaticResource TextSecondary}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Extras View -->
|
||||
<StackPanel x:Name="viewExtras" Visibility="Collapsed">
|
||||
<TextBlock Text="Extras" FontSize="26" FontWeight="SemiBold" Margin="0,0,0,20"/>
|
||||
|
||||
<WrapPanel>
|
||||
<Button x:Name="btnChangeWin" Content="Change Windows Edition" Width="200" Margin="0,0,10,10"/>
|
||||
<Button x:Name="btnChangeOffice" Content="Change Office Edition" Width="200" Margin="0,0,10,10"/>
|
||||
<Button x:Name="btnCheckStatus" Content="Check Activation Status" Width="200" Margin="0,0,10,10"/>
|
||||
<Button x:Name="btnTroubleshoot" Content="Troubleshoot" Width="200" Margin="0,0,10,10"/>
|
||||
<Button x:Name="btnOEM" Content="Extract OEM Folder" Width="200" Margin="0,0,10,10"/>
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Logs & Info" FontSize="16" FontWeight="SemiBold" Margin="0,20,0,10"/>
|
||||
<Border Background="#252525" Padding="15" CornerRadius="4">
|
||||
<TextBlock Text="This GUI wraps the official MAS scripts. When you click an action, a terminal window will open to perform the operation safely and transparently." TextWrapping="Wrap" Foreground="{StaticResource TextSecondary}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
"@
|
||||
|
||||
# --- Load & Parse ---
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try {
|
||||
$window = [Windows.Markup.XamlReader]::Load($reader)
|
||||
} catch {
|
||||
Write-Error "Failed to load XAML: $_"
|
||||
Exit
|
||||
}
|
||||
|
||||
# --- Find Controls ---
|
||||
$navHome = $window.FindName("navHome")
|
||||
$navActivators = $window.FindName("navActivators")
|
||||
$navExtras = $window.FindName("navExtras")
|
||||
|
||||
$viewHome = $window.FindName("viewHome")
|
||||
$viewActivators = $window.FindName("viewActivators")
|
||||
$viewExtras = $window.FindName("viewExtras")
|
||||
|
||||
$btnHomeHWID = $window.FindName("btnHomeHWID")
|
||||
$btnHWID = $window.FindName("btnHWID")
|
||||
$btnOhook = $window.FindName("btnOhook")
|
||||
$btnKMS = $window.FindName("btnKMS")
|
||||
|
||||
$btnChangeWin = $window.FindName("btnChangeWin")
|
||||
$btnChangeOffice = $window.FindName("btnChangeOffice")
|
||||
$btnCheckStatus = $window.FindName("btnCheckStatus")
|
||||
$btnTroubleshoot = $window.FindName("btnTroubleshoot")
|
||||
$btnOEM = $window.FindName("btnOEM")
|
||||
|
||||
# --- Logic: Navigation ---
|
||||
function Switch-View {
|
||||
param($view)
|
||||
$viewHome.Visibility = "Collapsed"
|
||||
$viewActivators.Visibility = "Collapsed"
|
||||
$viewExtras.Visibility = "Collapsed"
|
||||
$view.Visibility = "Visible"
|
||||
}
|
||||
|
||||
$navHome.Add_Checked({ Switch-View $viewHome })
|
||||
$navActivators.Add_Checked({ Switch-View $viewActivators })
|
||||
$navExtras.Add_Checked({ Switch-View $viewExtras })
|
||||
|
||||
# --- Logic: Execution ---
|
||||
function Invoke-MASScript {
|
||||
param([string]$Path)
|
||||
$fullPath = Join-Path $PSScriptRoot $Path
|
||||
if (Test-Path $fullPath) {
|
||||
Start-Process "cmd.exe" -ArgumentList "/c `"$fullPath`""
|
||||
} else {
|
||||
[System.Windows.MessageBox]::Show("Script not found at:`n$fullPath", "Error", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
}
|
||||
}
|
||||
|
||||
$btnHomeHWID.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Activators\HWID_Activation.cmd" })
|
||||
$btnHWID.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Activators\HWID_Activation.cmd" })
|
||||
$btnOhook.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Activators\Ohook_Activation_AIO.cmd" })
|
||||
$btnKMS.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Activators\Online_KMS_Activation.cmd" })
|
||||
|
||||
$btnChangeWin.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Change_Windows_Edition.cmd" })
|
||||
$btnChangeOffice.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Change_Office_Edition.cmd" })
|
||||
$btnCheckStatus.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Check_Activation_Status.cmd" })
|
||||
$btnTroubleshoot.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Troubleshoot.cmd" })
|
||||
$btnOEM.Add_Click({ Invoke-MASScript "MAS\Separate-Files-Version\Extract_OEM_Folder.cmd" })
|
||||
|
||||
# --- Run ---
|
||||
$window.ShowDialog() | Out-Null
|
||||
Loading…
Add table
Add a link
Reference in a new issue