26 Commits

Author SHA1 Message Date
d78e262f5b Clarify the on/off status in add/remove Office apps option 2025-07-22 05:16:41 +05:30
fd1e146753 dot-source scriptblock 2025-07-22 04:50:50 +05:30
bc781ad079 Remove KMS38 protection feature, it's not important. 2025-07-22 04:40:17 +05:30
43cceb366e Fix issues in checking expired Office products 2025-07-22 02:02:52 +05:30
39bcefa02b Improve error info 2025-07-22 00:55:14 +05:30
2b37400aa8 Detect unsupported languages for Office 2019 Perpetual VL update channel 2025-07-22 00:12:59 +05:30
1fb65d4f9c Fix an issue in add/remove apps when more than one lang is installed 2025-07-21 14:10:52 +05:30
10b6e8b6dc Show Ohook in green if O365 is installed 2025-07-18 00:27:13 +05:30
cb36c19f01 Show a tip about ESU updates 2025-07-17 23:21:08 +05:30
4aa811dd5e Update info 2025-07-17 21:40:37 +05:30
5d37a99966 Add ESU support for Core editions (Release preview 19045.6156) 2025-07-17 21:34:04 +05:30
64a726202c Update list 2025-07-12 12:18:44 +05:30
c3e70173e4 Skip changing region in top countries 2025-07-12 03:53:16 +05:30
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
13 changed files with 685 additions and 348 deletions

6
.gitattributes vendored
View File

@ -1,4 +1,4 @@
MAS export-ignore # MAS export-ignore
LICENSE export-ignore # LICENSE export-ignore
README.md export-ignore # README.md export-ignore
.gitattributes export-ignore .gitattributes export-ignore

View File

@ -1,5 +1,5 @@
@::fh36d7f-random @::yfh37fow-random
@set masver=3.3 @set masver=3.4
@setlocal DisableDelayedExpansion @setlocal DisableDelayedExpansion
@echo off @echo off
@ -215,7 +215,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%
@ -260,6 +260,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 ', '))}"""
) )
@ -283,7 +287,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=
) )
@ -393,23 +399,33 @@ color 07
title Microsoft %blank%Activation %blank%Scripts %masver% title Microsoft %blank%Activation %blank%Scripts %masver%
if not defined terminal mode 76, 34 if not defined terminal mode 76, 34
if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _hwidgo=1 if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set _serexist=1
if %winbuild% GTR 14393 if exist "%SysPath%\spp\tokens\skus\EnterpriseSN\" set _hwidgo= if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _evalexist=1
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-EnterpriseS*dition~*.mum" set _ltscexist=1
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-EnterpriseSN*dition~*.mum" set _ltscnexist=1
if %winbuild% GEQ 10240 if not defined _serexist if not defined _evalexist set _hwidgo=1
if %winbuild% GTR 14393 if defined _ltscnexist set _hwidgo=
if not defined _hwidgo set _tsforgego=1 if not defined _hwidgo set _tsforgego=1
set _ohookgo=1 set _ohookgo=1
if %winbuild% GEQ 9200 ( if %winbuild% GEQ 9200 (
if %winbuild% LSS 10240 set _ohookgo= if %winbuild% LSS 10240 set _ohookgo=
if %winbuild% GEQ 19041 if %winbuild% LEQ 19045 set _ohookgo= if %winbuild% GEQ 19041 if %winbuild% LEQ 19045 set _ohookgo=
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set _ohookgo= if defined _serexist set _ohookgo=
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _ohookgo= if defined _evalexist set _ohookgo=
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-EnterpriseS*dition~*.mum" set _ohookgo= if defined _ltscexist set _ohookgo=
reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun\Configuration /v ProductReleaseIds %nul2% | find /i "O365" %nul% && set _ohookgo=1
reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\ClickToRun\Configuration /v ProductReleaseIds %nul2% | find /i "O365" %nul% && set _ohookgo=1
) )
if not defined _ohookgo set _tsforgego=1 if not defined _ohookgo set _tsforgego=1
echo: echo:
echo: echo:
echo: echo:
if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined _serexist if not defined _evalexist if not defined _ltscexist (
call :dk_color2 %_Green% " Tip:" %_White% " To activate ESU updates after W10 EOL, use TSforge option."
)
echo: echo:
echo: ______________________________________________________________ echo: ______________________________________________________________
echo: echo:
@ -572,7 +588,7 @@ set "_dir=!desktop!\$OEM$\$$\Setup\Scripts"
md "!_dir!\" md "!_dir!\"
:: Add random data on top to create unique file which helps in avoiding AV's detections :: Add random data on top to create unique file which helps in avoiding AV's detections
%psc% "$f=[io.file]::ReadAllText('!_batp!'); [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\MAS_AIO.cmd', '@::RANDOM-' + [Guid]::NewGuid().Guid + [Environment]::NewLine + $f, [System.Text.Encoding]::ASCII)" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!'); [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\MAS_AIO.cmd', '@::RANDOM-' + [Guid]::NewGuid().Guid + [Environment]::NewLine + $f, [System.Text.Encoding]::ASCII)"
( (
echo @echo off echo @echo off
@ -795,7 +811,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
) )
@ -853,12 +869,15 @@ call :dk_inskey "[%key%]"
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b"
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b"
set regionchange= :: Skip changing region in top countries
if not "%name%"=="US" (
set regionchange=1 set regionchange=1
for %%# in (US CN IN BR DE JP GB FR MX ID IT PK TR KR CA ES AU NG VN PL PH NL EG AR TH CO SA TW MY CL) do if /i "%name%"=="%%#" set regionchange=
if defined regionchange (
%psc% "Set-WinHomeLocation -GeoId 244" %nul% %psc% "Set-WinHomeLocation -GeoId 244" %nul%
if !errorlevel! EQU 0 ( if !errorlevel! EQU 0 (
echo Changing Windows Region To USA [Successful] echo Changing Windows Region To USA [Successful] [Script will change it back]
) else ( ) else (
call :dk_color %Red% "Changing Windows Region To USA [Failed]" call :dk_color %Red% "Changing Windows Region To USA [Failed]"
) )
@ -1206,7 +1225,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%
@ -1653,7 +1672,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
@ -1749,14 +1768,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -1798,9 +1819,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1843,7 +1864,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"
@ -2423,6 +2444,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 (
@ -2480,6 +2502,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 (
@ -2739,6 +2762,28 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
echo %_oIds% | find /i "Volume" %nul% || exit /b
for %%# in (%*) do (
if %%#==2013 set _offver=
if %%#==2016 set _offver=
if %%#==2019 set _offver=2019
if %%#==2021 set _offver=2021
if %%#==2024 set _offver=2024
if exist "!_oLPath!\ProPlus!_offver!PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus!_offver!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 (
@ -2853,7 +2898,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% || (
@ -3365,8 +3410,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
@ -3702,7 +3747,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:
@ -4097,6 +4142,8 @@ if !_el!==1 cls & setlocal & set "_actwin=1" & call :ts_start & endlocal
goto :ts_menu goto :ts_menu
) )
goto :ts_start
::======================================================================================================================================== ::========================================================================================================================================
:ts_changemethod :ts_changemethod
@ -4109,25 +4156,26 @@ echo:
echo: echo:
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color2 %_White% " [1] " %_Green% " Auto" call :dk_color2 %_White% " [1] " %_Green% "Auto"
echo Build 19041 and later: echo Builds ^>= 19041 - StaticCID (KMS4k if offline)
echo Uses StaticCID, or KMS4k if offline. echo Builds ^< 19041 - ZeroCID
echo Older builds: Uses ZeroCID. echo __________________________________________________
echo _______________________________________________
echo: echo:
echo [2] StaticCID echo [2] StaticCID
echo Needs Internet. echo Needs Internet
echo Not for Windows 7 or older. echo Not for Windows 7 or older
echo _______________________________________________ echo __________________________________________________
echo: echo:
echo [3] ZeroCID echo [3] ZeroCID
echo Works only on builds below 19041. echo Works reliably on builds below 19041
echo _______________________________________________ echo May break on builds between 19041-26100
echo Does not work on builds above 26100.4188
echo __________________________________________________
echo: echo:
echo [4] KMS4k echo [4] KMS4k
echo This applies only to volume products. echo Volume licenses only
echo Activates for 4000+ years using KMS. echo Activates for 4000+ years
echo _______________________________________________ echo __________________________________________________
echo: echo:
echo [5] Learn More echo [5] Learn More
echo [0] %_exitmsg% echo [0] %_exitmsg%
@ -4266,7 +4314,7 @@ echo Checking Internet Connection [Connected!ping_f!]
if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k
if /i !tsmethod!==KMS4k ( if /i !tsmethod!==KMS4k (
call :dk_color %Gray% "Checking Internet Connection [Not Connected]" call :dk_color %Gray% "Checking Internet Connection [Not Connected]"
call :dk_color %Blue% "Switching To KMS4k Activation Method because Internet is needed for StaticCID method." call :dk_color %Blue% "Switching To KMS4k activation because Internet is needed for StaticCID method."
) else ( ) else (
set error=1 set error=1
call :dk_color %Red% "Checking Internet Connection [Not Connected]" call :dk_color %Red% "Checking Internet Connection [Not Connected]"
@ -4338,7 +4386,7 @@ if defined _vis goto :ts_winvista
set tempid= set tempid=
if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero)
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a)
) )
@ -4628,7 +4676,7 @@ goto :ts_esu
) )
set resetstuff=1 set resetstuff=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))"
set resetstuff= set resetstuff=
if !errorlevel!==3 ( if !errorlevel!==3 (
set error=1 set error=1
@ -4677,6 +4725,14 @@ if exist "%SystemRoot%\Servicing\Packages\WinEmb-Branding-Embedded-Standard-Pack
) )
if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
set w10EsuEditions=Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh
set /a UBR=0
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
if %winbuild% EQU 19045 if %UBR% GEQ 6156 (
set w10EsuEditionsLaterAdded=Core-CoreN-CoreCountrySpecific-CoreSingleLanguage-IoTEnterprise-
)
if not defined isThinpc if not defined isltsc for %%# in ( if not defined isThinpc if not defined isltsc for %%# in (
REM Windows7 REM Windows7
4220f546-f522-46df-8202-4d07afd26454_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseE-EnterpriseN-Professional-ProfessionalE-ProfessionalN-Ultimate-UltimateE-UltimateN- 4220f546-f522-46df-8202-4d07afd26454_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseE-EnterpriseN-Professional-ProfessionalE-ProfessionalN-Ultimate-UltimateE-UltimateN-
@ -4693,10 +4749,10 @@ REM Windows8.1
REM WindowsServer2012/2012R2 REM WindowsServer2012/2012R2
55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10 REM Windows10
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise- b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise-
7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise- 7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise-
4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise- 4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise-
@ -4742,13 +4798,14 @@ goto :ts_off
) )
if defined esuexistbutnosup ( if defined esuexistbutnosup (
call :dk_color %Red% "Checking Activation ID [Commercial ESU is not supported for %tsedition%]" call :dk_color %Red% "Checking Activation ID [Currently installed ESU License is not supported for %tsedition%]"
echo %esueditionlist% | find /i "Professional" %nul1% && ( echo:
call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option, and change it to [Professional] or any non-Home edition." if %winbuild% EQU 19045 if not defined w10EsuEditionsLaterAdded (
) || ( call :dk_color %Blue% "To get latest version, go to Windows settings and run Windows Update. After that, try the script again."
goto :ts_off
)
call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions." call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions."
echo [%esueditionlist%] echo [%esueditionlist%]
)
goto :ts_off goto :ts_off
) )
@ -4977,6 +5034,7 @@ set error=1
goto :ts_starto16c2r goto :ts_starto16c2r
) )
call :oh_expiredpreview 2013
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ts_process call :ts_process
@ -5018,6 +5076,7 @@ set error=1
goto :ts_startmsi goto :ts_startmsi
) )
call :oh_expiredpreview 2016 2019 2021 2024
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ts_process call :ts_process
@ -5101,10 +5160,10 @@ if %winbuild% GEQ 10586 (
for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do (
if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"")
) )
if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'" %nul% if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul%
) )
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a)
) )
@ -5298,7 +5357,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
echo: echo:
set resetstuff=1 set resetstuff=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))"
if %errorlevel%==3 ( if %errorlevel%==3 (
call :dk_color %Red% "Reset Failed." call :dk_color %Red% "Reset Failed."
@ -5346,7 +5405,7 @@ if %errorlevel%==1 exit /b
echo: echo:
echo Fetching Supported Activation IDs list. Please wait... echo Fetching Supported Activation IDs list. Please wait...
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':listactids\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))"
if %errorlevel%==3 ( if %errorlevel%==3 (
call :dk_color %Gray% "No supported activation ID found, aborting..." call :dk_color %Gray% "No supported activation ID found, aborting..."
goto :dk_done goto :dk_done
@ -5495,7 +5554,7 @@ echo Writing TrustedStore data...
if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...)
) )
echo: echo:
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%"
if !errorlevel!==3 ( if !errorlevel!==3 (
if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%")
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@ -5689,7 +5748,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k
set keytype=zero set keytype=zero
) )
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a)
) )
set "_allactid=!tsids!" set "_allactid=!tsids!"
@ -11647,9 +11706,6 @@ exit /b
:: To activate, run the script with "/KMS38" parameter or change 0 to 1 in below line :: To activate, run the script with "/KMS38" parameter or change 0 to 1 in below line
set _act=0 set _act=0
:: To remove KMS38 protection, run the script with /KMS38-RemoveProtection parameter or change 0 to 1 in below line
set _rem=0
:: To disable changing edition if current edition doesn't support KMS38 activation, change the value to 1 from 0 or run the script with "/KMS38-NoEditionChange" parameter :: To disable changing edition if current edition doesn't support KMS38 activation, change the value to 1 from 0 or run the script with "/KMS38-NoEditionChange" parameter
set _NoEditionChange=0 set _NoEditionChange=0
@ -11670,13 +11726,12 @@ if defined _args set _args=%_args:"=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="/KMS38" set _act=1 if /i "%%A"=="/KMS38" set _act=1
if /i "%%A"=="/KMS38-RemoveProtection" set _rem=1
if /i "%%A"=="/KMS38-NoEditionChange" set _NoEditionChange=1 if /i "%%A"=="/KMS38-NoEditionChange" set _NoEditionChange=1
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
) )
) )
for %%A in (%_act% %_rem% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1) for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
::======================================================================================================================================== ::========================================================================================================================================
@ -11699,8 +11754,6 @@ goto dk_done
::======================================================================================================================================== ::========================================================================================================================================
if %_rem%==1 goto :k_uninstall
:k_menu :k_menu
if %_unattended%==0 ( if %_unattended%==0 (
@ -11717,7 +11770,7 @@ echo:
echo [1] KMS38 Activation echo [1] KMS38 Activation
echo ____________________________________________ echo ____________________________________________
echo: echo:
echo [2] Remove KM38 Protection echo [2] Remove KMS38 Activation
echo: echo:
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo: ______________________________________________________ echo: ______________________________________________________
@ -11984,8 +12037,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])" call :dk_color %Blue% "Specific KMS registry is locked. %_fixmsg%"
%nul% reg delete "HKLM\%specific_kms%" /f
) )
set k_error= set k_error=
@ -12151,18 +12203,6 @@ echo Removing the Added Specific KMS Host [Successful]
) )
) )
:: Protect KMS38 if opted by the user and conditions are correct
if defined _k38 (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
%nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && (
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
) || (
call :dk_color %Red% "Protect KMS38 From KMS [Failed to Lock a Registry Key]"
)
)
:: clipup.exe does not exist in server cor and acor editions by default, it was copied there with this script :: clipup.exe does not exist in server cor and acor editions by default, it was copied there with this script
if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul% if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
@ -12192,57 +12232,30 @@ goto :dk_done
cls cls
if not defined terminal mode 99, 28 if not defined terminal mode 99, 28
title Remove KMS38 Protection %masver% title Remove KMS38 Activation %masver%
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
echo:
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" call :dk_color %Red% "Failed to remove specific KMS Host."
%nul% reg delete "HKLM\%specific_kms%" /f call :dk_color %Blue% "%_fixmsg%"
) || (
echo Successfully removed specific KMS Host.
) )
echo: echo:
%nul% reg query "HKLM\%specific_kms%" && ( echo KMS38 activation doesn't modify any Windows components and doesn't install any new files.
call :dk_color %Red% "Removing Specific KMS Host [Failed]" echo:
) || ( call :dk_color %Gray% "If you want to reset the activation status,"
echo Removing Specific KMS Host [Successful] call :dk_color %Blue% "%_fixmsg%"
) echo:
goto :dk_done goto :dk_done
::======================================================================================================================================== ::========================================================================================================================================
:: This code runs to protect/undo below registry key for KMS38 protection
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
:: KMS38 protection stops 180 days KMS Activation from replacing KMS38 activation
:regdel:
param (
[switch]$protect
)
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
if($protect) {
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
} else {
$ruleArgs = @("$Admin", "FullControl", "Allow")
}
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
$acl = $key.GetAccessControl()
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
$acl.ResetAccessRule($rule)
$key.SetAccessControl($acl)
:regdel:
::========================================================================================================================================
:: Check KMS activation status :: Check KMS activation status
:k_actinfo :k_actinfo
@ -12963,6 +12976,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
@ -13003,6 +13017,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
@ -13915,8 +13930,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)
@ -13975,7 +13990,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)"
::======================================================================================================================================== ::========================================================================================================================================
@ -14005,7 +14020,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
::======================================================================================================================================== ::========================================================================================================================================
@ -14759,7 +14774,7 @@ mode 100, 36
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=35;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=35;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
) )
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))"
goto dk_done goto dk_done
:sppmgr: :sppmgr:
@ -16631,6 +16646,25 @@ echo:
call :dk_color %Blue% "Rebuilding SPP licensing tokens..." call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
echo: echo:
echo Clearing KMS Cache...
echo:
call :_taskclear-cache
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
echo Removing KMS38 protection...
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
call :dk_color %Red% "Failed to remove KMS38 protection."
) || (
echo Successfully removed KMS38 protection.
echo Successfully cleared KMS Cache.
)
) || (
echo Successfully cleared KMS Cache.
)
echo:
call :scandat check call :scandat check
if not defined token ( if not defined token (
@ -16656,7 +16690,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]"
@ -16726,8 +16760,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 (
@ -17346,7 +17380,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
@ -17376,6 +17410,36 @@ $acl.SetAccessRule($rule)
$key.SetAccessControl($acl) $key.SetAccessControl($acl)
:regown: :regown:
::========================================================================================================================================
:: This code runs to undo below registry key KMS38 protection
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
:: This option is not used in KMS38 anymore, it's here only to remove previous versions protection.
:regdel:
param (
[switch]$protect
)
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
if($protect) {
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
} else {
$ruleArgs = @("$Admin", "FullControl", "Allow")
}
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
$acl = $key.GetAccessControl()
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
$acl.ResetAccessRule($rule)
$key.SetAccessControl($acl)
:regdel:
:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ :+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:change_winedition :change_winedition
@ -17489,7 +17553,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
@ -17695,7 +17759,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%
@ -17733,7 +17797,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%
@ -18475,9 +18539,10 @@ goto :oe_edition
:oe_editionchangepre :oe_editionchangepre
cls cls
set editedition=
call :ch_getinfo call :ch_getinfo
call :oe_tempcleanup call :oe_tempcleanup
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
:oe_editionchange :oe_editionchange
@ -18551,7 +18616,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.
@ -18593,7 +18658,8 @@ if not defined terminal mode 98, 32
%line% %line%
echo: echo:
call :dk_color %Gray% "Target edition: %targetedition%" call :dk_color %Gray% "Target edition: %targetedition%"
call :dk_color %Gray% "You can exclude the below apps from installation." call :dk_color %Gray% "To exclude the apps listed below from installation, toggle them from On to Off."
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps."
%line% %line%
if defined suites echo: if defined suites echo:
if defined Access_st echo [A] Access : %Access_st% if defined Access_st echo [A] Access : %Access_st%
@ -18720,7 +18786,9 @@ goto :oe_goback
:: OfficeClickToRun.exe with productstoadd method is used here to add editions :: OfficeClickToRun.exe with productstoadd method is used here to add editions
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet :: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" call :oe_getlangs
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
if %change%==1 ( if %change%==1 (
set "c2rcommand=!c2rcommand! productstoremove=AllProducts" set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
@ -18792,6 +18860,7 @@ goto :oe_goback
) )
set change=0 set change=0
set editedition=1
call :ch_getinfo call :ch_getinfo
cls cls
@ -18897,13 +18966,8 @@ if %verified%==0 goto :oe_removeedition
cls cls
if not defined terminal mode 105, 32 if not defined terminal mode 105, 32
set _lang= call :oe_getlangs %targetedition%
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9) set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16_%_allLangs%"
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%targetedition%.16" /f "-" /k ^| findstr /i ".*16\\.*-.*"') do (
if defined _lang (set "_lang=!_lang!_%%a") else (set "_lang=_%%a")
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16%_lang%"
echo: echo:
echo Running the below command, please wait... echo Running the below command, please wait...
@ -19032,7 +19096,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:
@ -19086,7 +19150,19 @@ goto :oe_goback
set buildchk=0 set buildchk=0
for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a" for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a"
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" call :oe_getlangs %_firstoId%
echo %targetchannel% | find /i "2019 VL" %nul% && (
for %%A in (en-gb es-mx fr-ca) do (
echo %_allLangs% | find /i "%%A" %nul% && (
%eline%
echo [%%A] language is not supported on the Office 2019 Perpetual VL update channel. Aborting...
goto :oe_goback
)
)
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE" set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE"
if %clverchk% LSS %buildchk% ( if %clverchk% LSS %buildchk% (
@ -19268,6 +19344,27 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:: Check all the installed languages
:oe_getlangs
if "%1"=="" (
set langreg=culture
) else (
set langreg=%1.16
)
set _allLangs=
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%langreg%" /f "-" /k ^| findstr /i "%langreg%\\.*-.*"') do (
if defined _allLangs (set "_allLangs=!_allLangs!_%%a") else (set "_allLangs=%%a")
)
set _allLangs=%_allLangs:.16=%
exit /b
::========================================================================================================================================
:: Check Internet connection :: Check Internet connection
:oe_chkinternet :oe_chkinternet

View File

@ -1,4 +1,4 @@
@set masver=3.3 @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
) )
@ -563,12 +569,15 @@ call :dk_inskey "[%key%]"
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b"
for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b"
set regionchange= :: Skip changing region in top countries
if not "%name%"=="US" (
set regionchange=1 set regionchange=1
for %%# in (US CN IN BR DE JP GB FR MX ID IT PK TR KR CA ES AU NG VN PL PH NL EG AR TH CO SA TW MY CL) do if /i "%name%"=="%%#" set regionchange=
if defined regionchange (
%psc% "Set-WinHomeLocation -GeoId 244" %nul% %psc% "Set-WinHomeLocation -GeoId 244" %nul%
if !errorlevel! EQU 0 ( if !errorlevel! EQU 0 (
echo Changing Windows Region To USA [Successful] echo Changing Windows Region To USA [Successful] [Script will change it back]
) else ( ) else (
call :dk_color %Red% "Changing Windows Region To USA [Failed]" call :dk_color %Red% "Changing Windows Region To USA [Failed]"
) )
@ -916,7 +925,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 +1356,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
@ -1443,14 +1452,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -1492,9 +1503,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1537,7 +1548,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.3 @set masver=3.4
@echo off @echo off
@ -15,9 +15,6 @@
:: To activate, run the script with "/KMS38" parameter or change 0 to 1 in below line :: To activate, run the script with "/KMS38" parameter or change 0 to 1 in below line
set _act=0 set _act=0
:: To remove KMS38 protection, run the script with /KMS38-RemoveProtection parameter or change 0 to 1 in below line
set _rem=0
:: To disable changing edition if current edition doesn't support KMS38 activation, change the value to 1 from 0 or run the script with "/KMS38-NoEditionChange" parameter :: To disable changing edition if current edition doesn't support KMS38 activation, change the value to 1 from 0 or run the script with "/KMS38-NoEditionChange" parameter
set _NoEditionChange=0 set _NoEditionChange=0
@ -155,13 +152,12 @@ if defined _args set _args=%_args:re2=%
if defined _args ( if defined _args (
for %%A in (%_args%) do ( for %%A in (%_args%) do (
if /i "%%A"=="/KMS38" set _act=1 if /i "%%A"=="/KMS38" set _act=1
if /i "%%A"=="/KMS38-RemoveProtection" set _rem=1
if /i "%%A"=="/KMS38-NoEditionChange" set _NoEditionChange=1 if /i "%%A"=="/KMS38-NoEditionChange" set _NoEditionChange=1
if /i "%%A"=="-el" set _elev=1 if /i "%%A"=="-el" set _elev=1
) )
) )
for %%A in (%_act% %_rem% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1) for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
::======================================================================================================================================== ::========================================================================================================================================
@ -240,7 +236,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 +281,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 +308,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=
) )
@ -376,8 +378,6 @@ cls
::======================================================================================================================================== ::========================================================================================================================================
if %_rem%==1 goto :k_uninstall
:k_menu :k_menu
if %_unattended%==0 ( if %_unattended%==0 (
@ -394,7 +394,7 @@ echo:
echo [1] KMS38 Activation echo [1] KMS38 Activation
echo ____________________________________________ echo ____________________________________________
echo: echo:
echo [2] Remove KM38 Protection echo [2] Remove KMS38 Activation
echo: echo:
echo [0] %_exitmsg% echo [0] %_exitmsg%
echo: ______________________________________________________ echo: ______________________________________________________
@ -661,8 +661,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])" call :dk_color %Blue% "Specific KMS registry is locked. %_fixmsg%"
%nul% reg delete "HKLM\%specific_kms%" /f
) )
set k_error= set k_error=
@ -828,18 +827,6 @@ echo Removing the Added Specific KMS Host [Successful]
) )
) )
:: Protect KMS38 if opted by the user and conditions are correct
if defined _k38 (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
%nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg query "HKLM\%specific_kms%" && (
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
) || (
call :dk_color %Red% "Protect KMS38 From KMS [Failed to Lock a Registry Key]"
)
)
:: clipup.exe does not exist in server cor and acor editions by default, it was copied there with this script :: clipup.exe does not exist in server cor and acor editions by default, it was copied there with this script
if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul% if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
@ -869,57 +856,30 @@ goto :dk_done
cls cls
if not defined terminal mode 99, 28 if not defined terminal mode 99, 28
title Remove KMS38 Protection %masver% title Remove KMS38 Activation %masver%
%nul% reg delete "HKLM\%specific_kms%" /f %nul% reg delete "HKLM\%specific_kms%" /f
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
echo:
%nul% reg query "HKLM\%specific_kms%" && ( %nul% reg query "HKLM\%specific_kms%" && (
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" call :dk_color %Red% "Failed to remove specific KMS Host."
%nul% reg delete "HKLM\%specific_kms%" /f call :dk_color %Blue% "%_fixmsg%"
) || (
echo Successfully removed specific KMS Host.
) )
echo: echo:
%nul% reg query "HKLM\%specific_kms%" && ( echo KMS38 activation doesn't modify any Windows components and doesn't install any new files.
call :dk_color %Red% "Removing Specific KMS Host [Failed]" echo:
) || ( call :dk_color %Gray% "If you want to reset the activation status,"
echo Removing Specific KMS Host [Successful] call :dk_color %Blue% "%_fixmsg%"
) echo:
goto :dk_done goto :dk_done
::======================================================================================================================================== ::========================================================================================================================================
:: This code runs to protect/undo below registry key for KMS38 protection
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
:: KMS38 protection stops 180 days KMS Activation from replacing KMS38 activation
:regdel:
param (
[switch]$protect
)
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
if($protect) {
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
} else {
$ruleArgs = @("$Admin", "FullControl", "Allow")
}
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
$acl = $key.GetAccessControl()
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
$acl.ResetAccessRule($rule)
$key.SetAccessControl($acl)
:regdel:
::========================================================================================================================================
:: Set variables :: Set variables
:dk_setvar :dk_setvar
@ -1016,7 +976,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 +1450,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
@ -1586,14 +1546,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -1635,9 +1597,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -1680,7 +1642,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.3 @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,28 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
echo %_oIds% | find /i "Volume" %nul% || exit /b
for %%# in (%*) do (
if %%#==2013 set _offver=
if %%#==2016 set _offver=
if %%#==2019 set _offver=2019
if %%#==2021 set _offver=2021
if %%#==2024 set _offver=2024
if exist "!_oLPath!\ProPlus!_offver!PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus!_offver!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 +1074,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 +1586,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 +2038,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
@ -2104,14 +2134,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -2153,9 +2185,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -2198,7 +2230,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 +2905,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.3 @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,28 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
echo %_oIds% | find /i "Volume" %nul% || exit /b
for %%# in (%*) do (
if %%#==2013 set _offver=
if %%#==2016 set _offver=
if %%#==2019 set _offver=2019
if %%#==2021 set _offver=2021
if %%#==2024 set _offver=2024
if exist "!_oLPath!\ProPlus!_offver!PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus!_offver!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 +1359,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 +1564,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 +2167,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 +2227,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 +2257,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 +2623,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 +3094,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
@ -3160,14 +3190,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -3209,9 +3241,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -3254,7 +3286,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.3 @set masver=3.4
@echo off @echo off
@ -303,7 +303,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%
@ -348,6 +348,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 ', '))}"""
) )
@ -371,7 +375,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=
) )
@ -497,6 +503,8 @@ if !_el!==1 cls & setlocal & set "_actwin=1" & call :ts_start & endlocal
goto :ts_menu goto :ts_menu
) )
goto :ts_start
::======================================================================================================================================== ::========================================================================================================================================
:ts_changemethod :ts_changemethod
@ -509,25 +517,26 @@ echo:
echo: echo:
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color2 %_White% " [1] " %_Green% " Auto" call :dk_color2 %_White% " [1] " %_Green% "Auto"
echo Build 19041 and later: echo Builds ^>= 19041 - StaticCID (KMS4k if offline)
echo Uses StaticCID, or KMS4k if offline. echo Builds ^< 19041 - ZeroCID
echo Older builds: Uses ZeroCID. echo __________________________________________________
echo _______________________________________________
echo: echo:
echo [2] StaticCID echo [2] StaticCID
echo Needs Internet. echo Needs Internet
echo Not for Windows 7 or older. echo Not for Windows 7 or older
echo _______________________________________________ echo __________________________________________________
echo: echo:
echo [3] ZeroCID echo [3] ZeroCID
echo Works only on builds below 19041. echo Works reliably on builds below 19041
echo _______________________________________________ echo May break on builds between 19041-26100
echo Does not work on builds above 26100.4188
echo __________________________________________________
echo: echo:
echo [4] KMS4k echo [4] KMS4k
echo This applies only to volume products. echo Volume licenses only
echo Activates for 4000+ years using KMS. echo Activates for 4000+ years
echo _______________________________________________ echo __________________________________________________
echo: echo:
echo [5] Learn More echo [5] Learn More
echo [0] %_exitmsg% echo [0] %_exitmsg%
@ -666,7 +675,7 @@ echo Checking Internet Connection [Connected!ping_f!]
if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k if /i %_actmethod%==Auto if not %_actman%==1 set tsmethod=KMS4k
if /i !tsmethod!==KMS4k ( if /i !tsmethod!==KMS4k (
call :dk_color %Gray% "Checking Internet Connection [Not Connected]" call :dk_color %Gray% "Checking Internet Connection [Not Connected]"
call :dk_color %Blue% "Switching To KMS4k Activation Method because Internet is needed for StaticCID method." call :dk_color %Blue% "Switching To KMS4k activation because Internet is needed for StaticCID method."
) else ( ) else (
set error=1 set error=1
call :dk_color %Red% "Checking Internet Connection [Not Connected]" call :dk_color %Red% "Checking Internet Connection [Not Connected]"
@ -738,7 +747,7 @@ if defined _vis goto :ts_winvista
set tempid= set tempid=
if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero)
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a)
) )
@ -1028,7 +1037,7 @@ goto :ts_esu
) )
set resetstuff=1 set resetstuff=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))"
set resetstuff= set resetstuff=
if !errorlevel!==3 ( if !errorlevel!==3 (
set error=1 set error=1
@ -1077,6 +1086,14 @@ if exist "%SystemRoot%\Servicing\Packages\WinEmb-Branding-Embedded-Standard-Pack
) )
if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
set w10EsuEditions=Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh
set /a UBR=0
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
if %winbuild% EQU 19045 if %UBR% GEQ 6156 (
set w10EsuEditionsLaterAdded=Core-CoreN-CoreCountrySpecific-CoreSingleLanguage-IoTEnterprise-
)
if not defined isThinpc if not defined isltsc for %%# in ( if not defined isThinpc if not defined isltsc for %%# in (
REM Windows7 REM Windows7
4220f546-f522-46df-8202-4d07afd26454_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseE-EnterpriseN-Professional-ProfessionalE-ProfessionalN-Ultimate-UltimateE-UltimateN- 4220f546-f522-46df-8202-4d07afd26454_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseE-EnterpriseN-Professional-ProfessionalE-ProfessionalN-Ultimate-UltimateE-UltimateN-
@ -1093,10 +1110,10 @@ REM Windows8.1
REM WindowsServer2012/2012R2 REM WindowsServer2012/2012R2
55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10 REM Windows10
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise- b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise-
7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise- 7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise-
4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise- 4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise-
@ -1142,13 +1159,14 @@ goto :ts_off
) )
if defined esuexistbutnosup ( if defined esuexistbutnosup (
call :dk_color %Red% "Checking Activation ID [Commercial ESU is not supported for %tsedition%]" call :dk_color %Red% "Checking Activation ID [Currently installed ESU License is not supported for %tsedition%]"
echo %esueditionlist% | find /i "Professional" %nul1% && ( echo:
call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option, and change it to [Professional] or any non-Home edition." if %winbuild% EQU 19045 if not defined w10EsuEditionsLaterAdded (
) || ( call :dk_color %Blue% "To get latest version, go to Windows settings and run Windows Update. After that, try the script again."
goto :ts_off
)
call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions." call :dk_color %Blue% "Go back to Main Menu, select Change Windows Edition option and change to any of the below listed editions."
echo [%esueditionlist%] echo [%esueditionlist%]
)
goto :ts_off goto :ts_off
) )
@ -1377,6 +1395,7 @@ set error=1
goto :ts_starto16c2r goto :ts_starto16c2r
) )
call :oh_expiredpreview 2013
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ts_process call :ts_process
@ -1418,6 +1437,7 @@ set error=1
goto :ts_startmsi goto :ts_startmsi
) )
call :oh_expiredpreview 2016 2019 2021 2024
if "%_actprojvis%"=="0" call :oh_fixprids if "%_actprojvis%"=="0" call :oh_fixprids
call :ts_process call :ts_process
@ -1501,10 +1521,10 @@ if %winbuild% GEQ 10586 (
for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do (
if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"")
) )
if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'" %nul% if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul%
) )
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a)
) )
@ -1698,7 +1718,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
echo: echo:
set resetstuff=1 set resetstuff=1
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))"
if %errorlevel%==3 ( if %errorlevel%==3 (
call :dk_color %Red% "Reset Failed." call :dk_color %Red% "Reset Failed."
@ -1746,7 +1766,7 @@ if %errorlevel%==1 exit /b
echo: echo:
echo Fetching Supported Activation IDs list. Please wait... echo Fetching Supported Activation IDs list. Please wait...
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':listactids\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))"
if %errorlevel%==3 ( if %errorlevel%==3 (
call :dk_color %Gray% "No supported activation ID found, aborting..." call :dk_color %Gray% "No supported activation ID found, aborting..."
goto :dk_done goto :dk_done
@ -1895,7 +1915,7 @@ echo Writing TrustedStore data...
if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...)
) )
echo: echo:
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%"
if !errorlevel!==3 ( if !errorlevel!==3 (
if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%")
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@ -1999,6 +2019,28 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:oh_expiredpreview
echo %_oIds% | find /i "Volume" %nul% || exit /b
for %%# in (%*) do (
if %%#==2013 set _offver=
if %%#==2016 set _offver=
if %%#==2019 set _offver=2019
if %%#==2021 set _offver=2021
if %%#==2024 set _offver=2024
if exist "!_oLPath!\ProPlus!_offver!PreviewVL_*.xrm-ms" if not exist "!_oLPath!\ProPlus!_offver!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
@ -2149,7 +2191,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k
set keytype=zero set keytype=zero
) )
for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (
echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a)
) )
set "_allactid=!tsids!" set "_allactid=!tsids!"
@ -2270,7 +2312,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% || (
@ -2475,8 +2517,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
@ -2631,7 +2673,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%
@ -3059,7 +3101,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
@ -3155,14 +3197,16 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking Rearm " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking Rearm [System is Rearmed]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState" %nul% && (
set error=1 set error=1
set showfix=1 set showfix=1
call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System Restart Is Required]" call :dk_color %Red% "Checking ClipSVC PersistedSystemState [Found]"
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
) )
@ -3204,9 +3248,9 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || ( if %winbuild% GEQ 7600 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]" call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers]"
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
set error=1 set error=1
set showfix=1 set showfix=1
) )
@ -3249,7 +3293,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.3 @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=
) )
@ -543,9 +549,10 @@ goto :oe_edition
:oe_editionchangepre :oe_editionchangepre
cls cls
set editedition=
call :ch_getinfo call :ch_getinfo
call :oe_tempcleanup call :oe_tempcleanup
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])" %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
:oe_editionchange :oe_editionchange
@ -619,7 +626,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.
@ -661,7 +668,8 @@ if not defined terminal mode 98, 32
%line% %line%
echo: echo:
call :dk_color %Gray% "Target edition: %targetedition%" call :dk_color %Gray% "Target edition: %targetedition%"
call :dk_color %Gray% "You can exclude the below apps from installation." call :dk_color %Gray% "To exclude the apps listed below from installation, toggle them from On to Off."
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps."
%line% %line%
if defined suites echo: if defined suites echo:
if defined Access_st echo [A] Access : %Access_st% if defined Access_st echo [A] Access : %Access_st%
@ -788,7 +796,9 @@ goto :oe_goback
:: OfficeClickToRun.exe with productstoadd method is used here to add editions :: OfficeClickToRun.exe with productstoadd method is used here to add editions
:: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet :: It uses delta updates, meaning that since it's using same installed build, it will consume very less Internet
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" call :oe_getlangs
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%targetedition%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%_updch% baseurl.16=http://officecdn.microsoft.com/pr/%_updch% version.16=%_version% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%_updch% %targetedition%.excludedapps.16=groove%excludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
if %change%==1 ( if %change%==1 (
set "c2rcommand=!c2rcommand! productstoremove=AllProducts" set "c2rcommand=!c2rcommand! productstoremove=AllProducts"
@ -860,6 +870,7 @@ goto :oe_goback
) )
set change=0 set change=0
set editedition=1
call :ch_getinfo call :ch_getinfo
cls cls
@ -965,13 +976,8 @@ if %verified%==0 goto :oe_removeedition
cls cls
if not defined terminal mode 105, 32 if not defined terminal mode 105, 32
set _lang= call :oe_getlangs %targetedition%
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9) set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16_%_allLangs%"
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%targetedition%.16" /f "-" /k ^| findstr /i ".*16\\.*-.*"') do (
if defined _lang (set "_lang=!_lang!_%%a") else (set "_lang=_%%a")
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% productstoremove=%targetedition%.16%_lang%"
echo: echo:
echo Running the below command, please wait... echo Running the below command, please wait...
@ -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:
@ -1154,7 +1160,19 @@ goto :oe_goback
set buildchk=0 set buildchk=0
for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a" for /f "tokens=3 delims=." %%a in ("%build%") do set "buildchk=%%a"
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_lang%_x-none cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled" call :oe_getlangs %_firstoId%
echo %targetchannel% | find /i "2019 VL" %nul% && (
for %%A in (en-gb es-mx fr-ca) do (
echo %_allLangs% | find /i "%%A" %nul% && (
%eline%
echo [%%A] language is not supported on the Office 2019 Perpetual VL update channel. Aborting...
goto :oe_goback
)
)
)
set "c2rcommand="%_c2rExe%" platform=%_oArch% culture=%_lang% productstoadd=%_firstoId%.16_%_allLangs% cdnbaseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% baseurl.16=http://officecdn.microsoft.com/pr/%targetFFN% version.16=%build% mediatype.16=CDN sourcetype.16=CDN deliverymechanism=%targetFFN% %_firstoId%.excludedapps.16=%_firstoIdExcludelist% flt.useteamsaddon=disabled flt.usebingaddononinstall=disabled flt.usebingaddononupdate=disabled"
set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE" set "c2rclientupdate=!c2rcommand! scenario=CLIENTUPDATE"
if %clverchk% LSS %buildchk% ( if %clverchk% LSS %buildchk% (
@ -1336,6 +1354,27 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:: Check all the installed languages
:oe_getlangs
if "%1"=="" (
set langreg=culture
) else (
set langreg=%1.16
)
set _allLangs=
echo "%o16c2r_reg%" | find /i "Wow6432Node" %nul1% && (set _tok=10) || (set _tok=9)
for /f "tokens=%_tok% delims=\" %%a in ('reg query "%o16c2r_reg%\ProductReleaseIDs\%_actconfig%\%langreg%" /f "-" /k ^| findstr /i "%langreg%\\.*-.*"') do (
if defined _allLangs (set "_allLangs=!_allLangs!_%%a") else (set "_allLangs=%%a")
)
set _allLangs=%_allLangs:.16=%
exit /b
::========================================================================================================================================
:: Check Internet connection :: Check Internet connection
:oe_chkinternet :oe_chkinternet

View File

@ -1,4 +1,4 @@
@set masver=3.3 @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.3 @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.3 @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=
) )
@ -691,6 +697,25 @@ echo:
call :dk_color %Blue% "Rebuilding SPP licensing tokens..." call :dk_color %Blue% "Rebuilding SPP licensing tokens..."
echo: echo:
echo Clearing KMS Cache...
echo:
call :_taskclear-cache
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
echo Removing KMS38 protection...
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
call :dk_color %Red% "Failed to remove KMS38 protection."
) || (
echo Successfully removed KMS38 protection.
echo Successfully cleared KMS Cache.
)
) || (
echo Successfully cleared KMS Cache.
)
echo:
call :scandat check call :scandat check
if not defined token ( if not defined token (
@ -716,7 +741,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 +811,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 (
@ -1254,6 +1279,59 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:: Clean existing K-M-S cache from the registry
:_taskclear-cache
set w=
for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do (
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%
)
set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"
if %winbuild% LSS 7600 (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && (
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL"
)
)
if not defined SPPk (
set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
)
set "slp=SoftwareLicensingProduct"
set "ospp=OfficeSoftwareProtectionProduct"
set "_wApp=55c92734-d682-4d71-983e-d6ec3f16059f"
set "_oApp=0ff1ce15-a989-479d-af46-f275c6370663"
set "_oA14=59a52881-a989-479d-af46-f275c6370663"
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServiceName /reg:32
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort
%nul% reg delete "HKLM\%SPPk%" /f /v KeyManagementServicePort /reg:32
%nul% reg delete "HKLM\%SPPk%" /f /v DisableDnsPublishing
%nul% reg delete "HKLM\%SPPk%" /f /v DisableKeyManagementServiceHostCaching
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
if %winbuild% GEQ 9200 (
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f
%nul% reg delete "HKLM\%SPPk%\%_oApp%" /f /reg:32
)
if %winbuild% GEQ 9600 (
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_wApp%" /f
%nul% reg delete "HKU\S-1-5-20\%SPPk%\%_oApp%" /f
)
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServiceName
%nul% reg delete "HKLM\%OPPk%" /f /v KeyManagementServicePort
%nul% reg delete "HKLM\%OPPk%" /f /v DisableDnsPublishing
%nul% reg delete "HKLM\%OPPk%" /f /v DisableKeyManagementServiceHostCaching
%nul% reg delete "HKLM\%OPPk%\%_oA14%" /f
%nul% reg delete "HKLM\%OPPk%\%_oApp%" /f
exit /b
::========================================================================================================================================
:: Fix SPP related registry and folder permissions :: Fix SPP related registry and folder permissions
:fixsppperms: :fixsppperms:
@ -1433,7 +1511,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
@ -1465,6 +1543,36 @@ $key.SetAccessControl($acl)
::======================================================================================================================================== ::========================================================================================================================================
:: This code runs to undo below registry key KMS38 protection
:: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f
:: This option is not used in KMS38 anymore, it's here only to remove previous versions protection.
:regdel:
param (
[switch]$protect
)
$SID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
$Admin = ($SID.Translate([System.Security.Principal.NTAccount])).Value
if($protect) {
$ruleArgs = @("$Admin", "Delete, SetValue", "ContainerInherit", "None", "Deny")
} else {
$ruleArgs = @("$Admin", "FullControl", "Allow")
}
$path = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f'
$key = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubKey($path, 'ReadWriteSubTree', 'ChangePermissions')
$acl = $key.GetAccessControl()
$rule = [System.Security.AccessControl.RegistryAccessRule]::new.Invoke($ruleArgs)
$acl.ResetAccessRule($rule)
$key.SetAccessControl($acl)
:regdel:
::========================================================================================================================================
:dk_color :dk_color
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (

View File

@ -69,8 +69,8 @@ or
--- ---
``` ```
Latest Version: 3.3 Latest Version: 3.4
Release date: 1-June-2025 Release date: 3-June-2025
``` ```
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot) ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)