1
0
mirror of https://github.com/massgravel/Microsoft-Activation-Scripts.git synced 2025-07-04 17:01:20 +01:00

19 Commits

Author SHA1 Message Date
c817ae8bd9 Add detection for Microsoft Defender for Endpoint 2025-07-02 23:46:34 +05:30
ef411e14ca Evade AV detection 2025-07-02 23:35:17 +05:30
5aa7d4f3de Revert "Evade AV detection"
This reverts commit 409c4f71ad.
2025-07-02 23:12:04 +05:30
409c4f71ad Evade AV detection 2025-06-26 22:49:57 +05:30
d7a6994363 Fix a bug in detecting Terminal app 2025-06-25 02:34:34 +05:30
5ad6226f37 Revert export-ignore 2025-06-03 18:37:59 +05:30
ae9f4e34ff export-ignore 2025-06-03 18:31:39 +05:30
67abcd0c89 3.4 2025-06-03 18:25:10 +05:30
faf3bf3a08 Update KMS server list 2025-06-03 17:23:00 +05:30
482600c890 Show info related to expired Office preview products 2025-06-03 16:44:13 +05:30
dc90e1ff0f Update info message related to ZCID 2025-06-03 14:55:20 +05:30
f969378f6b Fix a bug in unattended mode in TSforge 2025-06-03 13:35:40 +05:30
c89bebdee8 Revert export-ignore 2025-06-01 21:10:50 +05:30
be7d101df5 Merge branch 'dev' 2025-06-01 20:57:31 +05:30
55b6fce50a Update readme 2025-06-01 20:46:56 +05:30
6566bb53c1 export-ignore 2025-06-01 20:31:23 +05:30
2e44a4a77b 3.3 2025-06-01 20:30:48 +05:30
9073a35fe0 Add StaticCID and KMS4k method in TSforge 2025-06-01 20:27:57 +05:30
a149fc5f20 Change hash 2025-05-18 13:08:08 +05:30
12 changed files with 2147 additions and 382 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -237,7 +237,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -282,6 +282,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -305,7 +309,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -505,7 +511,7 @@ set notworking=
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if defined allapps call :hwiddata key if defined allapps call :hwiddata key
if not defined key ( if not defined key (
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getactivationid\:.*';iex ($f[1])"') do (set altapplist=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a)
if defined altapplist call :hwiddata key if defined altapplist call :hwiddata key
) )
@ -916,7 +922,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
set winsub=1 set winsub=1
set osSKU=%regSKU% set osSKU=%regSKU%
@ -1347,7 +1353,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
set wpainfo= set wpainfo=
set wpaerror= set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
@ -1537,7 +1543,7 @@ set showfix=1
if not defined notwinact ( if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -240,7 +240,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -285,6 +285,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -308,7 +312,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -661,7 +667,7 @@ echo:
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
) )
@ -831,7 +837,7 @@ echo Removing the Added Specific KMS Host [Successful]
:: Protect KMS38 if opted by the user and conditions are correct :: Protect KMS38 if opted by the user and conditions are correct
if defined _k38 ( if defined _k38 (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key] echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
@ -875,7 +881,7 @@ title Remove KMS38 Protection %masver%
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
) )
@ -1016,7 +1022,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
set winsub=1 set winsub=1
set osSKU=%regSKU% set osSKU=%regSKU%
@ -1490,7 +1496,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
set wpainfo= set wpainfo=
set wpaerror= set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
@ -1680,7 +1686,7 @@ set showfix=1
if not defined notwinact ( if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -245,7 +245,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -290,6 +290,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -313,7 +317,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -614,6 +620,7 @@ set error=1
goto :starto16c2r goto :starto16c2r
) )
call :oh_expiredpreview 2013
call :oh_fixprids call :oh_fixprids
call :oh_process call :oh_process
if defined isOspp ( if defined isOspp (
@ -671,6 +678,7 @@ set error=1
goto :startmsi goto :startmsi
) )
call :oh_expiredpreview 2016 2019 2021 2024
call :oh_fixprids call :oh_fixprids
call :oh_process call :oh_process
if defined isOspp ( if defined isOspp (
@ -930,6 +938,21 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
for %%# in (%*) do (
if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" (
set error=1
set showfix=1
call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]"
call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again."
)
)
exit /b
::========================================================================================================================================
:oh_ppcpath :oh_ppcpath
if not defined isOspp ( if not defined isOspp (
@ -1044,7 +1067,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do (
if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"")
) )
%psc% "$sls = Get-WmiObject %sps%; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul%
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% || ( echo "!allapps!" | find /i "!_actid!" %nul1% || (
@ -1556,8 +1579,8 @@ exit /b
:oh_licrefresh :oh_licrefresh
if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( if exist "%SysPath%\spp\store_test\2.0\tokens.dat" (
%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $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%
) )
exit /b exit /b
@ -2008,7 +2031,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
set wpainfo= set wpainfo=
set wpaerror= set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
@ -2198,7 +2221,7 @@ set showfix=1
if not defined notwinact ( if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"
@ -2873,7 +2896,7 @@ exit /b
:oh_extractdll :oh_extractdll
set b= set b=
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';& ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1
exit /b exit /b
:hexedit: :hexedit:

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -276,7 +276,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -321,6 +321,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -344,7 +348,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -876,6 +882,7 @@ set error=1
goto :ks_starto16c2r goto :ks_starto16c2r
) )
call :oh_expiredpreview 2013
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ks_process call :ks_process
@ -916,6 +923,7 @@ set error=1
goto :ks_startmsi goto :ks_startmsi
) )
call :oh_expiredpreview 2016 2019 2021 2024
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ks_process call :ks_process
@ -1096,6 +1104,21 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
for %%# in (%*) do (
if exist "!_oLPath!\ProPlus%%#PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus%%#VL_*.xrm-ms" (
set error=1
set showfix=1
call :dk_color %Red% "Checking Expired Preview Products [Office %%# Preview Found]"
call :dk_color %Blue% "Please run the Office updates first, and then attempt to activate it again."
)
)
exit /b
::========================================================================================================================================
:: Some Office Retail to Volume converter tools may edit the ProductReleaseIds to add VL products. This code restores it because it may affect features. :: Some Office Retail to Volume converter tools may edit the ProductReleaseIds to add VL products. This code restores it because it may affect features.
:oh_fixprids :oh_fixprids
@ -1329,7 +1352,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do (
if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"")
) )
%psc% "$sls = Get-WmiObject %sps%; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul%
call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo "!allapps!" | find /i "!_actid!" %nul1% || ( echo "!allapps!" | find /i "!_actid!" %nul1% || (
@ -1534,8 +1557,8 @@ exit /b
:oh_licrefresh :oh_licrefresh
if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( if exist "%SysPath%\spp\store_test\2.0\tokens.dat" (
%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $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%
) )
exit /b exit /b
@ -2137,8 +2160,8 @@ set srvlist=
set -= set -=
set "srvlist=kms.03%-%k.org kms-default.cangs%-%hui.net kms.six%-%yin.com kms.moe%-%club.org kms.cgt%-%soft.com" set "srvlist=kms.03%-%k.org kms-default.cangs%-%hui.net kms.six%-%yin.com kms.moe%-%club.org kms.cgt%-%soft.com"
set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.my%-%ds.cloud" set "srvlist=%srvlist% kms.id%-%ina.cn kms.moe%-%yuuko.com xinch%-%eng213618.cn kms.lol%-%i.best kms.mc%-%06.net"
set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%pym.com" set "srvlist=%srvlist% kms.0%-%t.net.cn win.k%-%ms.pub kms.wx%-%lost.com kms.moe%-%yuuko.top kms.gh%-%xi.com"
set n=1 set n=1
for %%a in (%srvlist%) do (set %%a=&set server!n!=%%a&set /a n+=1) for %%a in (%srvlist%) do (set %%a=&set server!n!=%%a&set /a n+=1)
@ -2197,7 +2220,7 @@ if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" /
if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul%
call :ks_createInfo.txt call :ks_createInfo.txt
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)"
::======================================================================================================================================== ::========================================================================================================================================
@ -2227,7 +2250,7 @@ exit /b
:ks_RenExport :ks_RenExport
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);"
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -2593,7 +2616,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a"
if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && (
if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" (
set winsub=1 set winsub=1
set osSKU=%regSKU% set osSKU=%regSKU%
@ -3064,7 +3087,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE
set wpainfo= set wpainfo=
set wpaerror= set wpaerror=
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
echo "%wpainfo%" | find /i "Error Found" %nul% && ( echo "%wpainfo%" | find /i "Error Found" %nul% && (
set error=1 set error=1
set wpaerror=1 set wpaerror=1
@ -3254,7 +3277,7 @@ set showfix=1
if not defined notwinact ( if not defined notwinact (
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps ( if not defined apps (
set "_notfoundids=Key Not Installed / Act ID Not Found" set "_notfoundids=Key Not Installed / Act ID Not Found"

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -190,7 +190,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -235,6 +235,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -258,7 +262,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -545,7 +551,7 @@ goto :oe_edition
cls cls
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
@ -619,7 +625,7 @@ 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.
@ -1100,7 +1106,7 @@ 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: echo:

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -195,7 +195,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -240,6 +240,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -263,7 +267,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -445,7 +451,7 @@ 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" (
if %winbuild% GEQ 17063 call :ced_edilist if %winbuild% GEQ 17063 call :ced_edilist
@ -651,7 +657,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%
@ -689,7 +695,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%

View File

@ -39,7 +39,7 @@ goto :E_Exit
set "_batf=%~f0" set "_batf=%~f0"
set "_batp=%_batf:'=''%" set "_batp=%_batf:'=''%"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
%_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';iex ($f[1])" %_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';& ([scriptblock]::Create($f[1]))"
:E_Exit :E_Exit
echo. echo.

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -206,7 +206,7 @@ goto done2
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -251,6 +251,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -274,7 +278,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -816,7 +822,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
::======================================================================================================================================== ::========================================================================================================================================

View File

@ -1,4 +1,4 @@
@set masver=3.2 @set masver=3.4
@echo off @echo off
@ -207,7 +207,7 @@ goto dk_done
::pstst $ExecutionContext.SessionState.LanguageMode :pstst ::pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) 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" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
@ -252,6 +252,10 @@ echo PowerShell is not working properly. Aborting...
if /i "!tstresult2!"=="FullLanguage" ( if /i "!tstresult2!"=="FullLanguage" (
echo: echo:
echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted.
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 ', '))}""" 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 ', '))}"""
) )
@ -275,7 +279,9 @@ set terminal=
if defined terminal ( if defined terminal (
set lines=0 set lines=0
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A 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 !lines! GEQ 100 set terminal=
) )
@ -716,7 +722,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]"
@ -786,8 +792,8 @@ if defined _vis (
echo: echo:
echo Reinstalling system licenses... echo Reinstalling system licenses...
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[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 (
@ -1433,7 +1439,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

234
README.md
View File

@ -1,118 +1,116 @@
<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, TSforge, 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>
## How to Activate Windows / Office? ## How to Activate Windows / Office?
### Method 1 - PowerShell (Windows 8 and later) ❤️ ### Method 1 - PowerShell (Windows 8 and later) ❤️
1. **Open PowerShell** 1. **Open PowerShell**
To do that, press the Windows key + X, then select PowerShell or Terminal. To do that, press the Windows key + X, then select PowerShell or Terminal.
2. **Copy and paste the code below, then press enter.** 2. **Copy and paste the code below, then press enter.**
``` ```
irm https://get.activated.win | iex irm https://get.activated.win | iex
``` ```
Alternatively, you can use the following (this will be deprecated in the future): Alternatively, you can use the following (this will be deprecated in the future):
``` ```
irm https://massgrave.dev/get | iex irm https://massgrave.dev/get | iex
``` ```
3. You will see the activation options. 3. You will see the activation options. Choose the activation options highlighted in green.
Press 1 HWID for Windows activation.
Press 2 Ohook for Office activation. 4. That's all
4. That's all ---
--- ### Method 2 - Traditional (Windows Vista and later)
### Method 2 - Traditional (Windows Vista and later) <details>
<summary>Click here to view</summary>
<details>
<summary>Click here to view</summary> 1. Download the file using one of the links below:
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip`
1. Download the file using one of the links below: or
`https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip` `https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip`
or 2. Right-click on the downloaded zip file and extract it.
`https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip` 3. In the extracted folder, find the folder named `All-In-One-Version`.
2. Right-click on the downloaded zip file and extract it. 4. Run the file named `MAS_AIO.cmd`.
3. In the extracted folder, find the folder named `All-In-One-Version`. 5. You will see the activation options. Follow the on-screen instructions.
4. Run the file named `MAS_AIO.cmd`. 6. That's all.
5. You will see the activation options. Follow the on-screen instructions.
6. That's all. </details>
</details> ---
--- - To activate additional products such as **Office for macOS, Visual Studio, RDS CALs, and Windows XP**, check [here](https://massgrave.dev/unsupported_products_activation).
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
- **[Office for macOS](https://massgrave.dev/office_for_mac)**
- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches). ---
--- ### Not working ❓
### Not working ❓ - If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above.
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
- If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above. - If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot).
- If MAS is launched and the script shows any errors, check for any troubleshooting steps mentioned in blue color and try to follow those.
- If you have any issues, please feel free to reach out to us [here](https://massgrave.dev/troubleshoot). ---
--- > [!NOTE]
>
> [!NOTE] > - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
> > - Always double-check the URL before executing the command and verify the source if manually downloading files.
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it. > - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command. ---
--- ```
Latest Version: 3.4
``` Release date: 3-June-2025
Latest Version: 3.2 ```
Release date: 6-May-2025
``` ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot) ### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
### Homepage - [https://massgrave.dev/](https://massgrave.dev/) <div align="center">
<div align="center"> [![1.1]][1]
[![1.2]][2]
[![1.1]][1] [![1.3]][3]
[![1.2]][2]
[![1.3]][3] </div>
</div> <div align="center">
<div align="center"> [![1.4]][4]
[![1.5]][5]
[![1.4]][4] [![1.6]][6]
[![1.5]][5] [![1.7]][7]
[![1.6]][6]
[![1.7]][7] </div>
</div> [1.1]: https://massgrave.dev/img/logo_github.png (GitHub)
[1.2]: https://massgrave.dev/img/logo_azuredevops.png (AzureDevOps)
[1.1]: https://massgrave.dev/img/logo_github.png (GitHub) [1.3]: https://massgrave.dev/img/logo_gitea.png (Self-hosted Git)
[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.4]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup) [1.6]: https://massgrave.dev/img/logo_bluesky.png (Bluesky)
[1.5]: https://massgrave.dev/img/logo_reddit.png (Reddit) [1.7]: https://massgrave.dev/img/logo_x.png (Twitter)
[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
[1]: https://github.com/massgravel/Microsoft-Activation-Scripts [3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts
[2]: https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts [4]: https://discord.gg/j2yFsV5ZVC
[3]: https://git.activated.win/massgrave/Microsoft-Activation-Scripts [5]: https://www.reddit.com/r/MAS_Activator
[4]: https://discord.gg/j2yFsV5ZVC [6]: https://bsky.app/profile/massgrave.dev
[5]: https://www.reddit.com/r/MAS_Activator [7]: https://twitter.com/massgravel
[6]: https://bsky.app/profile/massgrave.dev
[7]: https://twitter.com/massgravel ---
--- <p align="center">Made with Love ❤️</p>
<p align="center">Made with Love ❤️</p>