Compare commits

...

20 Commits

Author SHA1 Message Date
WitherOrNot f34d025d51 MAS 3.12 2026-07-04 03:48:39 -04:00
Lyssa a9d539e763 Fix malware detection messages 2026-06-11 21:21:17 +04:00
Lyssa d084ef3fb6 Update some troubleshoot messages 2026-06-11 20:10:30 +04:00
Lyssa bf9da8b5d8 Remove "Probable" from malware error 2026-06-11 17:27:03 +04:00
WitherOrNot 166814e52d Update separate file versions 2026-05-07 14:01:10 +00:00
May 694976cd35 cleanup 2026-05-07 07:09:03 +00:00
WitherOrNot 7b78fffd7f Update README.md 2026-05-02 04:18:36 -04:00
WitherOrNot 983762fc78 Revert "export-ignore"
This reverts commit 5bde60199b.
2026-05-02 02:26:31 -04:00
WitherOrNot b990647262 more masver 2026-05-02 02:24:41 -04:00
WitherOrNot 5bde60199b export-ignore 2026-05-02 02:18:16 -04:00
WitherOrNot 7e5cda65c1 masver 2026-05-02 02:15:09 -04:00
Wither OrNot d1c0050718 Add Years 4 and 5 for Windows Server 2012/2012R2 ESU 2026-04-17 15:03:37 -04:00
Lyssa 2a4fe194fb Add OutlookForWindows in app selection menu 2026-03-09 11:34:17 +04:00
WindowsAddict-Alt2 1baa4e18ed Add OutlookForWindows in app selection menu 2026-03-09 03:49:09 +05:30
WitherOrNot 33b0ac9cc7 Add Windows 10 LTSB 2016 ESU 2026-02-21 19:25:30 -05:00
Lyssa 97602941e5 lol 2026-02-01 11:25:52 +04:00
Lyssa 773b758f4d Deal with false positive (again) 2026-01-31 21:40:41 +04:00
Lyssa c07796e405 Change file hash 2026-01-30 18:08:15 +04:00
Lyssa 3e3fe2ca52 Update release date in README 2026-01-29 16:31:39 +04:00
Lyssa d33dfc9ce6 Revert export-ignore 2026-01-28 19:25:27 +04:00
12 changed files with 493 additions and 423 deletions
+4 -4
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
+154 -149
View File
@@ -1,5 +1,9 @@
@::ab7249d77random13141b5922144806de5d43f @::Please stop false-flagging this script over and over. This is the 3rd time I've had to update the script to deal with the false positives.
@set masver=3.10 @::Nothing in this script is malicious and it is used by thousands of people *daily*.
@::Is a real person even the one deciding to flag this or is it Copilot told to flag anything it decides not to like?
@::If a campaign is using this script as a cover, please flag parts of the campaign instead of the script. This isn't the first time we experienced collateral damage due to campaigns completely unrelated to us.
@::If you disagree that MAS is not malicious, we would appreciate if you contacted us to explain what constitutes MAS as "Sonbokli" and we'll look into it. Thank you.
@set masver=3.12
@setlocal DisableDelayedExpansion @setlocal DisableDelayedExpansion
@echo off @echo off
@@ -37,9 +41,20 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="re1" set re1=1 if /i "%%#"=="re1" set re1=1
if /i "%%#"=="re2" set re2=1 if /i "%%#"=="re2" set re2=1
@@ -87,8 +102,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -97,10 +111,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -184,10 +196,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -196,7 +207,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -225,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -326,11 +337,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -605,7 +616,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=[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)" %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)"
( (
echo @echo off echo @echo off
@@ -820,7 +831,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=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';. ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) for /f "delims=" %%a in ('%psc% "$f=[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
) )
@@ -1242,7 +1253,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=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[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%
@@ -1889,7 +1900,7 @@ set showfix=1
set chkalp= set chkalp=
set wpainfo=NotFound set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp ( if defined chkalp (
@@ -1963,7 +1974,7 @@ set showfix=1
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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1 if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
) )
@@ -2327,8 +2338,8 @@ set key=%%B
REM Generate ticket REM Generate ticket
if %1==ticket if "%key%"=="%%B" ( if %1==ticket if "%key%"=="%%B" (
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;" set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=221306452340115677963964261259250411589493550039199940431586886;"
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
) )
) )
@@ -2403,7 +2414,7 @@ $SignatureStr = SignProperties $PropertiesStr $rsa
$xml = @" $xml = @"
<?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>$PropertiesStr</properties><signatures><signature name="clientLockboxKey" method="rsa-sha256">$SignatureStr</signature></signatures></genuineProperties></genuineAuthorization> <?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>$PropertiesStr</properties><signatures><signature name="clientLockboxKey" method="rsa-sha256">$SignatureStr</signature></signatures></genuineProperties></genuineAuthorization>
"@ "@
[System.IO.File]::WriteAllText("$env:ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\GenuineTicket", ($xml -join ""), [System.Text.Encoding]::ASCII) [IO.File]::WriteAllText("$env:ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\GenuineTicket", ($xml -join ""), [System.Text.Encoding]::ASCII)
:sign: :sign:
::======================================================================================================================================== ::========================================================================================================================================
@@ -3185,7 +3196,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[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% || (
@@ -3225,18 +3236,9 @@ set ierror=mklink sppcs.dll
goto :oh_hookinstall_error goto :oh_hookinstall_error
) )
set exhook=
if exist "!_work!\BIN\%_hook%" set exhook=1
if not exist "%_hookPath%\sppc.dll" ( if not exist "%_hookPath%\sppc.dll" (
if defined exhook (
pushd "!_work!\BIN\"
copy /y /b "%_hook%" "%_hookPath%\sppc.dll" %nul%
popd
) else (
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%" call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
) )
)
if not exist "%_hookPath%\sppc.dll" ( if not exist "%_hookPath%\sppc.dll" (
set ierror=Copy set ierror=Copy
goto :oh_hookinstall_error goto :oh_hookinstall_error
@@ -3244,11 +3246,7 @@ goto :oh_hookinstall_error
echo: echo:
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful] echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
if defined exhook (
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
) else (
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
)
goto :oh_hookinstall_error goto :oh_hookinstall_error
@@ -3314,18 +3312,8 @@ set ierror=mklink sppcs.dll
goto :oh_hookinstall_error goto :oh_hookinstall_error
) )
set exhook=
if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1
if defined exhook (
pushd "!_work!\BIN\"
if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%)
if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%)
popd
) else (
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%") if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%") if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
)
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1) if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1) if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
@@ -3338,13 +3326,8 @@ goto :oh_hookinstall_error
echo: echo:
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"]) if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"]) if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
if defined exhook (
if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
) else (
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
)
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"] echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
@@ -3716,8 +3699,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
) )
exit /b exit /b
@@ -4053,7 +4036,7 @@ exit /b
:oh_extractdll :oh_extractdll
set b= set b=
%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 %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\:.*';. ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1
exit /b exit /b
:hexedit: :hexedit:
@@ -4092,8 +4075,8 @@ $Writer.Write($unixTimestamp)
$Writer.Flush() $Writer.Flush()
# Write the current state of the MemoryStream to a temporary file # Write the current state of the MemoryStream to a temporary file
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())" $tempFilePath = "$env:windir\Temp\$([Guid]::NewGuid().Guid)"
[System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray()) [IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
# Update hash using the temporary file # Update hash using the temporary file
[int]$HeaderSum = 0 [int]$HeaderSum = 0
@@ -4116,7 +4099,7 @@ Remove-Item -Path $tempFilePath -Force
$modifiedBytes = $MemoryStream.ToArray() $modifiedBytes = $MemoryStream.ToArray()
# Write the modified bytes to the final file # Write the modified bytes to the final file
[System.IO.File]::WriteAllBytes($PePath, $modifiedBytes) [IO.File]::WriteAllBytes($PePath, $modifiedBytes)
[void]$Imagehlp::MapFileAndCheckSum($PePath, [ref]$HeaderSum, [ref]$CheckSum) [void]$Imagehlp::MapFileAndCheckSum($PePath, [ref]$HeaderSum, [ref]$CheckSum)
if ($HeaderSum -ne $CheckSum) { if ($HeaderSum -ne $CheckSum) {
@@ -4146,12 +4129,6 @@ $MemoryStream.Close()
:: ::
::======================================================================================================================================== ::========================================================================================================================================
:: ::
:: If you want to use a different sppc.dll or without base64 format, then create a folder named "BIN" where this script is located and
:: place these two files in that "BIN" folder. sppc32.dll, sppc64.dll
:: Script will auto pick that instead of using the below from base64 section. You can also delete the below code in that case.
::
::========================================================================================================================================
::
:: Replace "-" with "A" and "_" with "a" before base64 conversion :: Replace "-" with "A" and "_" with "a" before base64 conversion
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding :: It was changed to prevent antiviruses from detecting and flagging base64 encoding
@@ -4463,7 +4440,9 @@ echo:
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color2 %_White% " [1] " %_Green% "Auto" call :dk_color2 %_White% " [1] " %_Green% "Auto"
echo Builds ^>= 26100 - StaticCID (KMS4k if offline) echo Builds ^>= 26100 - Windows only - KMS4k
echo Other options - StaticCID
echo:
echo Builds ^< 26100 - ZeroCID echo Builds ^< 26100 - ZeroCID
echo __________________________________________________ echo __________________________________________________
echo: echo:
@@ -4584,6 +4563,9 @@ if /i %_actmethod%==KMS4k set tsmethod=KMS4k
if /i %_actmethod%==Auto ( if /i %_actmethod%==Auto (
if %winbuild% GEQ 26100 ( if %winbuild% GEQ 26100 (
set tsmethod=StaticCID set tsmethod=StaticCID
if !_actwin!==1 if not !_actwinesuoff!==1 (
set tsmethod=KMS4k
)
) else ( ) else (
set tsmethod=ZeroCID set tsmethod=ZeroCID
) )
@@ -4688,7 +4670,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=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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)
) )
@@ -4699,7 +4681,7 @@ call :dk_color %Red% "Checking Activation ID [Not Found] [%tsed
set error=1 set error=1
if /i %tsmethod%==KMS4k ( if /i %tsmethod%==KMS4k (
if /i %_actmethod%==Auto ( if /i %_actmethod%==Auto (
call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." call :dk_color %Blue% "Return to the previous menu and select StaticCID activation method. Internet connection is required to activate."
) else ( ) else (
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
) )
@@ -4978,7 +4960,7 @@ goto :ts_esu
) )
set resetstuff=1 set resetstuff=1
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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
@@ -5017,7 +4999,7 @@ set esuexistsup=
set esueditionlist= set esueditionlist=
set esuexistbutnosup= set esuexistbutnosup=
for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1) if %winbuild% GTR 14393 for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1 if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1
if /i %tsedition%==Embedded ( if /i %tsedition%==Embedded (
@@ -5055,6 +5037,7 @@ REM Windows8.1
11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE- 11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE-
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-
1b60284a-63b5-42da-8ec9-eaab825e2bc8_Server-ESU-Year5[4-5y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10 REM Windows10
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded% f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded% 1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
@@ -5063,6 +5046,9 @@ f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuE
REM WindowsServer2016 REM WindowsServer2016
91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10LTSB2016
f2571710-2c24-4677-8fb5-a07d41d3c1aa_Client-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
22badfe6-7d55-4485-874b-7ec317442134_Client-ESU-Year6[4-6y]_-EnterpriseS-EnterpriseSN-
) do ( ) do (
for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do (
echo "%allapps%" | find /i "%%A" %nul1% && ( echo "%allapps%" | find /i "%%A" %nul1% && (
@@ -5118,7 +5104,7 @@ goto :ts_off
set esuavail= set esuavail=
if defined _vis if defined isServer set esuavail=1 if defined _vis if defined isServer set esuavail=1
if %winbuild% LEQ 7602 if not defined _vis if not defined isThinpc set esuavail=1 if %winbuild% LEQ 7602 if not defined _vis if not defined isThinpc set esuavail=1
if %winbuild% GTR 7602 if %winbuild% LSS 14393 if defined isServer set esuavail=1 if %winbuild% GTR 7602 if %winbuild% LEQ 14393 if defined isServer set esuavail=1
if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined isServer set esuavail=1 if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined isServer set esuavail=1
if %winbuild% EQU 9600 set esuavail=1 if %winbuild% EQU 9600 set esuavail=1
@@ -5466,10 +5452,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul%
) )
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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)
) )
@@ -5663,7 +5649,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
echo: echo:
set resetstuff=1 set resetstuff=1
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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."
@@ -5711,7 +5697,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=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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
@@ -5861,13 +5847,13 @@ 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=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%"
if !errorlevel!==3 ( if !errorlevel!==3 (
if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%") if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
) else ( ) else (
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 ( if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 if %_actwin%==1 (
echo: echo:
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored." call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method." if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
@@ -6064,7 +6050,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=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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!"
@@ -11253,27 +11239,27 @@ namespace LibTSforge.PhysicalStore
} }
'@ '@
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$binPath = "$env:_work\BIN\LibTSforge.dll"
$psMajorVer = (Get-Host).Version.Major $psMajorVer = (Get-Host).Version.Major
$build = [System.Environment]::OSVersion.Version.Build $build = [System.Environment]::OSVersion.Version.Build
if (Test-Path -LiteralPath $binPath) { $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
Add-Type -Path $binPath $lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
}
else {
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
$ctemp = "$env:SystemRoot\Temp\" $ctemp = "$env:SystemRoot\Temp\$([Guid]::NewGuid().Guid)\"
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
$env:TMP = $ctemp $env:TMP = $ctemp
$env:TEMP = $ctemp $env:TEMP = $ctemp
$cp.GenerateInMemory = $true $cp.GenerateInMemory = $true
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
try {
$cp.TempFiles.Dispose()
} catch {
# Older .NET Framework versions do not have that method, but they also don't create the folder that it removes.
} }
Remove-Item -Path $ctemp
if ($env:_debug -eq '0') { if ($env:_debug -eq '0') {
[LibTSforge.Logger]::HideOutput = $true [LibTSforge.Logger]::HideOutput = $true
@@ -11375,7 +11361,7 @@ if (-not $env:resetstuff) {
if ($env:tsmethod -eq "KMS4k") { if ($env:tsmethod -eq "KMS4k") {
if ($build -ge 26100) { if ($build -ge 26100) {
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
Write-Host "From build 26100.7019, Windows will always display and stay at 180 days remaining if the actual period is longer." -ForegroundColor White -BackgroundColor Darkgray Write-Host "From build 26100.7019, Windows will always display a remaining activation period of 180 days in Settings." -ForegroundColor White -BackgroundColor Darkgray
} }
else { else {
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
@@ -13586,7 +13572,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=[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)" %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)"
::======================================================================================================================================== ::========================================================================================================================================
@@ -13616,7 +13602,7 @@ exit /b
:ks_RenExport :ks_RenExport
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);"
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@@ -14464,7 +14450,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=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))"
goto dk_done goto dk_done
:sppmgr: :sppmgr:
@@ -16379,7 +16365,7 @@ call :_taskclear-cache
%nul% reg query "HKLM\%SPPk%\%_wApp%" && ( %nul% reg query "HKLM\%SPPk%\%_wApp%" && (
echo Removing KMS38 protection... echo Removing KMS38 protection...
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
%nul% reg query "HKLM\%SPPk%\%_wApp%" && ( %nul% reg query "HKLM\%SPPk%\%_wApp%" && (
call :dk_color %Red% "Failed to remove KMS38 protection." call :dk_color %Red% "Failed to remove KMS38 protection."
@@ -16417,7 +16403,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=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul% %psc% "$f=[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]"
@@ -16487,8 +16473,8 @@ if defined _vis (
echo: echo:
echo Reinstalling system licenses... echo Reinstalling system licenses...
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[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 (
@@ -16893,8 +16879,8 @@ goto :at_menu
:: https://stackoverflow.com/a/46268232 :: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%"" for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G"
%nul% del /q /f %ddf% set "ddf="%SystemRoot%\Temp\%Random%%randguid%""
echo/.New Cabinet>%ddf% echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf% echo/.set Cabinet=ON>>%ddf%
echo/.set CabinetFileCountThreshold=0;>>%ddf% echo/.set CabinetFileCountThreshold=0;>>%ddf%
@@ -16916,7 +16902,6 @@ for /f "tokens=* delims=" %%D in ('dir /a:-D/b/s "%SystemRoot%\logs\%1"') do (
echo/"%%~fD" /inf=no;>>%ddf% echo/"%%~fD" /inf=no;>>%ddf%
) )
makecab /F %ddf% /D DiskDirectory1="" /D CabinetNameTemplate="!desktop!\%2_%_time%.cab" makecab /F %ddf% /D DiskDirectory1="" /D CabinetNameTemplate="!desktop!\%2_%_time%.cab"
del /q /f %ddf%
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@@ -17111,7 +17096,7 @@ exit /b
:regownstart :regownstart
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));" %psc% "$f=[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
@@ -17280,7 +17265,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=[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% 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% 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
@@ -17488,7 +17473,7 @@ echo:
call :ced_prep call :ced_prep
if defined preperror goto dk_done if defined preperror goto dk_done
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%"
call :ced_postprep call :ced_postprep
) )
%line% %line%
@@ -17526,7 +17511,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=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%"
call :ced_postprep call :ced_postprep
%line% %line%
@@ -17882,7 +17867,7 @@ if($false -eq ($installCandidates.Keys -contains $SetEdition)) {
Exit 1 Exit 1
} }
$xmlPath = $Env:SystemRoot + '\Temp' + '\CbsUpgrade.xml' $xmlPath = $Env:SystemRoot + '\Temp' + "\$([Guid]::NewGuid().Guid)CbsUpgrade.xml"
Write-UpgradeXml -RemovalCandidates $removalCandidates ` Write-UpgradeXml -RemovalCandidates $removalCandidates `
-InstallCandidates $installCandidates[$SetEdition] ` -InstallCandidates $installCandidates[$SetEdition] `
@@ -18176,6 +18161,18 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
set "o_randguid="
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid" ^| findstr /r "^[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*$"') do set "o_randguid=%%G"
if not defined o_randguid (
%eline%
echo Unable to generate GUID with PowerShell.
echo Aborting...
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
md "%SystemRoot%\Temp\%o_randguid%\"
::======================================================================================================================================== ::========================================================================================================================================
:oemenu :oemenu
@@ -18264,7 +18261,7 @@ cls
set editedition= set editedition=
call :ch_getinfo call :ch_getinfo
call :oe_tempcleanup call :oe_tempcleanup
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
:oe_editionchange :oe_editionchange
@@ -18274,7 +18271,7 @@ mode 98, 45
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
) )
if not exist %SystemRoot%\Temp\%list%.txt ( if not exist %SystemRoot%\Temp\%o_randguid%\%list%.txt (
%eline% %eline%
echo Failed to generate available editions list. echo Failed to generate available editions list.
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@@ -18296,7 +18293,7 @@ if %winbuild% LSS 10240 (
echo Unsupported products such as 2019/2021/2024 are excluded from this list. echo Unsupported products such as 2019/2021/2024 are excluded from this list.
) else ( ) else (
for %%# in (2019 2021 2024) do ( for %%# in (2019 2021 2024) do (
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || ( find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\%list%.txt" %nul1% || (
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#) if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
) )
) )
@@ -18305,7 +18302,7 @@ if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this li
%line% %line%
echo: echo:
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%list%.txt) do ( for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%o_randguid%\%list%.txt) do (
set /a counter+=1 set /a counter+=1
if !counter! LSS 10 ( if !counter! LSS 10 (
echo [!counter!] %%A echo [!counter!] %%A
@@ -18337,8 +18334,8 @@ 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=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
if not exist %SystemRoot%\Temp\getAppIds.txt ( if not exist %SystemRoot%\Temp\%o_randguid%\getAppIds.txt (
%eline% %eline%
echo Failed to generate available apps list. echo Failed to generate available apps list.
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@@ -18360,7 +18357,7 @@ Visio
Word Word
) do ( ) do (
if defined suites ( if defined suites (
find /i "%%#" "%SystemRoot%\Temp\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=) find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
) else ( ) else (
set %%#_st= set %%#_st=
) )
@@ -18370,6 +18367,11 @@ if defined Lync_st set Lync_st=Off
set OneDrive_st=Off set OneDrive_st=Off
if defined suites (set Teams_st=Off) else (set Teams_st=) if defined suites (set Teams_st=Off) else (set Teams_st=)
set OutlookForWindows_st=
if %winbuild% GEQ 19041 if defined Outlook_st echo %targetedition% | find /i "O365" %nul1% && (
set OutlookForWindows_st=Off
)
:oe_excludeapps :oe_excludeapps
cls cls
@@ -18382,19 +18384,20 @@ call :dk_color %Gray% "To exclude the apps listed below from installation, toggl
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps." 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%
if defined Excel_st echo [E] Excel : %Excel_st% if defined Excel_st echo [E] Excel : %Excel_st%
if defined OneNote_st echo [N] OneNote : %OneNote_st% if defined OneNote_st echo [N] OneNote : %OneNote_st%
if defined Outlook_st echo [O] Outlook : %Outlook_st% if defined Outlook_st echo [O] Outlook ^(Classic^) : %Outlook_st%
if defined PowerPoint_st echo [P] PowerPoint : %PowerPoint_st% if defined PowerPoint_st echo [P] PowerPoint : %PowerPoint_st%
if defined Project_st echo [J] Project : %Project_st% if defined Project_st echo [J] Project : %Project_st%
if defined Publisher_st echo [R] Publisher : %Publisher_st% if defined Publisher_st echo [R] Publisher : %Publisher_st%
if defined Visio_st echo [V] Visio : %Visio_st% if defined Visio_st echo [V] Visio : %Visio_st%
if defined Word_st echo [W] Word : %Word_st% if defined Word_st echo [W] Word : %Word_st%
echo: echo:
if defined Lync_st echo [L] SkypeForBusiness : %Lync_st% if defined Lync_st echo [L] SkypeForBusiness : %Lync_st%
if defined OneDrive_st echo [D] OneDrive : %OneDrive_st% if defined OutlookForWindows_st echo [K] Outlook ^(New^) : %OutlookForWindows_st%
if defined Teams_st echo [T] Teams : %Teams_st% if defined OneDrive_st echo [D] OneDrive : %OneDrive_st%
if defined Teams_st echo [T] Teams : %Teams_st%
%line% %line%
echo: echo:
echo [1] Continue echo [1] Continue
@@ -18402,22 +18405,23 @@ echo [0] Go Back
%line% %line%
echo: echo:
call :dk_color %_Green% "Choose a menu option using your keyboard:" call :dk_color %_Green% "Choose a menu option using your keyboard:"
choice /C:AENOPJRVWLDT10 /N choice /C:AENOPJRVWLKDT10 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==14 goto :oemenu if !_el!==15 goto :oemenu
if !_el!==13 call :excludelist & goto :oe_editionchangefinal if !_el!==14 call :excludelist & goto :oe_editionchangefinal
if !_el!==12 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off)) if !_el!==13 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off))
if !_el!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off)) if !_el!==12 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
if !_el!==10 if defined Lync_st (if "%Lync_st%"=="Off" (set Lync_st=ON) else (set Lync_st=Off)) if !_el!==11 if defined OutlookForWindows_st (if "%OutlookForWindows_st%"=="Off" (set OutlookForWindows_st=ON) else (set OutlookForWindows_st=Off))
if !_el!==9 if defined Word_st (if "%Word_st%"=="Off" (set Word_st=ON) else (set Word_st=Off)) if !_el!==10 if defined Lync_st (if "%Lync_st%"=="Off" (set Lync_st=ON) else (set Lync_st=Off))
if !_el!==8 if defined Visio_st (if "%Visio_st%"=="Off" (set Visio_st=ON) else (set Visio_st=Off)) if !_el!==9 if defined Word_st (if "%Word_st%"=="Off" (set Word_st=ON) else (set Word_st=Off))
if !_el!==7 if defined Publisher_st (if "%Publisher_st%"=="Off" (set Publisher_st=ON) else (set Publisher_st=Off)) if !_el!==8 if defined Visio_st (if "%Visio_st%"=="Off" (set Visio_st=ON) else (set Visio_st=Off))
if !_el!==6 if defined Project_st (if "%Project_st%"=="Off" (set Project_st=ON) else (set Project_st=Off)) if !_el!==7 if defined Publisher_st (if "%Publisher_st%"=="Off" (set Publisher_st=ON) else (set Publisher_st=Off))
if !_el!==5 if defined PowerPoint_st (if "%PowerPoint_st%"=="Off" (set PowerPoint_st=ON) else (set PowerPoint_st=Off)) if !_el!==6 if defined Project_st (if "%Project_st%"=="Off" (set Project_st=ON) else (set Project_st=Off))
if !_el!==4 if defined Outlook_st (if "%Outlook_st%"=="Off" (set Outlook_st=ON) else (set Outlook_st=Off)) if !_el!==5 if defined PowerPoint_st (if "%PowerPoint_st%"=="Off" (set PowerPoint_st=ON) else (set PowerPoint_st=Off))
if !_el!==3 if defined OneNote_st (if "%OneNote_st%"=="Off" (set OneNote_st=ON) else (set OneNote_st=Off)) if !_el!==4 if defined Outlook_st (if "%Outlook_st%"=="Off" (set Outlook_st=ON) else (set Outlook_st=Off))
if !_el!==2 if defined Excel_st (if "%Excel_st%"=="Off" (set Excel_st=ON) else (set Excel_st=Off)) if !_el!==3 if defined OneNote_st (if "%OneNote_st%"=="Off" (set OneNote_st=ON) else (set OneNote_st=Off))
if !_el!==1 if defined Access_st (if "%Access_st%"=="Off" (set Access_st=ON) else (set Access_st=Off)) if !_el!==2 if defined Excel_st (if "%Excel_st%"=="Off" (set Excel_st=ON) else (set Excel_st=Off))
if !_el!==1 if defined Access_st (if "%Access_st%"=="Off" (set Access_st=ON) else (set Access_st=Off))
goto :oe_excludeapps goto :oe_excludeapps
:excludelist :excludelist
@@ -18434,6 +18438,7 @@ publisher
visio visio
word word
lync lync
outlookforwindows
onedrive onedrive
teams teams
) do ( ) do (
@@ -18814,7 +18819,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=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) for /f "delims=" %%a in ('%psc% "$f=[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:
@@ -18976,11 +18981,11 @@ exit /b
:oe_tempcleanup :oe_tempcleanup
del /f /q %SystemRoot%\Temp\SingleApps_Volume.txt %nul% del %SystemRoot%\Temp\%o_randguid%\SingleApps_Volume.txt %nul%
del /f /q %SystemRoot%\Temp\SingleApps_Retail.txt %nul% del %SystemRoot%\Temp\%o_randguid%\SingleApps_Retail.txt %nul%
del /f /q %SystemRoot%\Temp\Suites_Volume.txt %nul% del %SystemRoot%\Temp\%o_randguid%\Suites_Volume.txt %nul%
del /f /q %SystemRoot%\Temp\Suites_Retail.txt %nul% del %SystemRoot%\Temp\%o_randguid%\Suites_Retail.txt %nul%
del /f /q %SystemRoot%\Temp\getAppIds.txt %nul% del %SystemRoot%\Temp\%o_randguid%\getAppIds.txt %nul%
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@@ -19134,7 +19139,7 @@ if ($windowsBuild -lt 9200) {
:getlist: :getlist:
$xmlPath1 = $env:_c2rXml $xmlPath1 = $env:_c2rXml
$xmlPath2 = $env:_masterxml $xmlPath2 = $env:_masterxml
$outputDir = $env:SystemRoot + "\Temp\" $outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
$buildNumber = [System.Environment]::OSVersion.Version.Build $buildNumber = [System.Environment]::OSVersion.Version.Build
$excludedKeywords = @("2019", "2021", "2024") $excludedKeywords = @("2019", "2021", "2024")
$productReleaseIds = @() $productReleaseIds = @()
@@ -19194,7 +19199,7 @@ foreach ($section in $categories.Keys) {
:getappnames: :getappnames:
$xmlPath = $env:_masterxml $xmlPath = $env:_masterxml
$targetSkuId = $env:targetedition $targetSkuId = $env:targetedition
$outputDir = $env:SystemRoot + "\Temp\" $outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt" $outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF") $excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -43,6 +43,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -120,8 +132,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -130,10 +141,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -205,10 +214,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -217,7 +225,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -246,7 +254,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -347,11 +355,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -407,7 +415,7 @@ title HWID Activation %masver%
echo: echo:
echo Initializing... echo Initializing...
call :dk_chkmal echo:
for %%# in ( for %%# in (
sppsvc.exe sppsvc.exe
@@ -529,7 +537,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=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';. ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) for /f "delims=" %%a in ('%psc% "$f=[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
) )
@@ -951,7 +959,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=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[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%
@@ -1201,15 +1209,15 @@ exit /b
set w= set w=
set results= set results=
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico if exist "%ProgramFiles%\KM%w%Spico" set pupfound=[KM%w%Spico]
if not defined pupfound ( if not defined pupfound (
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound=[KM%w%Spico]
) )
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" if %hcount%==4 set "results=[Antivirus Domains Blocked In Hosts File] "
sc start %_slser% %nul% sc start %_slser% %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
@@ -1219,9 +1227,9 @@ if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%re
) )
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators %pupfound%"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "Checking for Mal%w%ware Infection... %results%"
if defined results (call :dk_color %Red% "%results%"&set showfix=1) call :dk_color %Gray% "It is highly likely that your Windows install is infected with mal%w%ware. Windows may fail to activate."
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@@ -1239,6 +1247,7 @@ exit /b
:dk_errorcheck :dk_errorcheck
echo:
set showfix= set showfix=
call :dk_chkmal call :dk_chkmal
@@ -1582,7 +1591,7 @@ set showfix=1
set chkalp= set chkalp=
set wpainfo=NotFound set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp ( if defined chkalp (
@@ -1656,7 +1665,7 @@ set showfix=1
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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1 if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
) )
@@ -1938,7 +1947,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -2020,8 +2029,8 @@ set key=%%B
REM Generate ticket REM Generate ticket
if %1==ticket if "%key%"=="%%B" ( if %1==ticket if "%key%"=="%%B" (
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;" set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=221306452340115677963964261259250411589493550039199940431586886;"
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
) )
) )
@@ -2096,7 +2105,7 @@ $SignatureStr = SignProperties $PropertiesStr $rsa
$xml = @" $xml = @"
<?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>$PropertiesStr</properties><signatures><signature name="clientLockboxKey" method="rsa-sha256">$SignatureStr</signature></signatures></genuineProperties></genuineAuthorization> <?xml version="1.0" encoding="utf-8"?><genuineAuthorization xmlns="http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0"><version>1.0</version><genuineProperties origin="sppclient"><properties>$PropertiesStr</properties><signatures><signature name="clientLockboxKey" method="rsa-sha256">$SignatureStr</signature></signatures></genuineProperties></genuineAuthorization>
"@ "@
[System.IO.File]::WriteAllText("$env:ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\GenuineTicket", ($xml -join ""), [System.Text.Encoding]::ASCII) [IO.File]::WriteAllText("$env:ProgramData\Microsoft\Windows\ClipSVC\GenuineTicket\GenuineTicket", ($xml -join ""), [System.Text.Encoding]::ASCII)
:sign: :sign:
::======================================================================================================================================== ::========================================================================================================================================
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -43,6 +43,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -120,8 +132,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -130,10 +141,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -214,10 +223,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -226,7 +234,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -255,7 +263,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -356,11 +364,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -457,7 +465,7 @@ title Ohook Activation %masver%
echo: echo:
echo Initializing... echo Initializing...
call :dk_chkmal echo:
if not exist %SysPath%\%_slexe% ( if not exist %SysPath%\%_slexe% (
%eline% %eline%
@@ -1110,7 +1118,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[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% || (
@@ -1150,18 +1158,9 @@ set ierror=mklink sppcs.dll
goto :oh_hookinstall_error goto :oh_hookinstall_error
) )
set exhook=
if exist "!_work!\BIN\%_hook%" set exhook=1
if not exist "%_hookPath%\sppc.dll" ( if not exist "%_hookPath%\sppc.dll" (
if defined exhook (
pushd "!_work!\BIN\"
copy /y /b "%_hook%" "%_hookPath%\sppc.dll" %nul%
popd
) else (
call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%" call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%"
) )
)
if not exist "%_hookPath%\sppc.dll" ( if not exist "%_hookPath%\sppc.dll" (
set ierror=Copy set ierror=Copy
goto :oh_hookinstall_error goto :oh_hookinstall_error
@@ -1169,11 +1168,7 @@ goto :oh_hookinstall_error
echo: echo:
echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful] echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful]
if defined exhook (
echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
) else (
echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful]
)
goto :oh_hookinstall_error goto :oh_hookinstall_error
@@ -1239,18 +1234,8 @@ set ierror=mklink sppcs.dll
goto :oh_hookinstall_error goto :oh_hookinstall_error
) )
set exhook=
if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1
if defined exhook (
pushd "!_work!\BIN\"
if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%)
if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%)
popd
) else (
if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%") if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%")
if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%") if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%")
)
if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1) if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1)
if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1) if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1)
@@ -1263,13 +1248,8 @@ goto :oh_hookinstall_error
echo: echo:
if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"]) if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"])
if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"]) if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"])
if defined exhook (
if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
) else (
if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"])
if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"])
)
echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"] echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"]
@@ -1641,8 +1621,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
) )
exit /b exit /b
@@ -1920,19 +1900,19 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" if %hcount%==4 set "results=Antivirus URLs blocked in hosts file"
sc start %_slser% %nul% sc start %_slser% %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%Likely File Infector"
) || ( ) || (
if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]") if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
) )
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "Checking for Mal%w%ware Infection... [%results%]"
if defined results (call :dk_color %Red% "%results%"&set showfix=1) call :dk_color %Gray% "It is highly likely that your Windows install is infected with mal%w%ware. Windows cannot be activated."
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@@ -2293,7 +2273,7 @@ set showfix=1
set chkalp= set chkalp=
set wpainfo=NotFound set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp ( if defined chkalp (
@@ -2367,7 +2347,7 @@ set showfix=1
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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1 if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
) )
@@ -2649,7 +2629,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -3147,7 +3127,7 @@ exit /b
:oh_extractdll :oh_extractdll
set b= set b=
%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 %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\:.*';. ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1
exit /b exit /b
:hexedit: :hexedit:
@@ -3186,8 +3166,8 @@ $Writer.Write($unixTimestamp)
$Writer.Flush() $Writer.Flush()
# Write the current state of the MemoryStream to a temporary file # Write the current state of the MemoryStream to a temporary file
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())" $tempFilePath = "$env:windir\Temp\$([Guid]::NewGuid().Guid)"
[System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray()) [IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
# Update hash using the temporary file # Update hash using the temporary file
[int]$HeaderSum = 0 [int]$HeaderSum = 0
@@ -3210,7 +3190,7 @@ Remove-Item -Path $tempFilePath -Force
$modifiedBytes = $MemoryStream.ToArray() $modifiedBytes = $MemoryStream.ToArray()
# Write the modified bytes to the final file # Write the modified bytes to the final file
[System.IO.File]::WriteAllBytes($PePath, $modifiedBytes) [IO.File]::WriteAllBytes($PePath, $modifiedBytes)
[void]$Imagehlp::MapFileAndCheckSum($PePath, [ref]$HeaderSum, [ref]$CheckSum) [void]$Imagehlp::MapFileAndCheckSum($PePath, [ref]$HeaderSum, [ref]$CheckSum)
if ($HeaderSum -ne $CheckSum) { if ($HeaderSum -ne $CheckSum) {
@@ -3240,12 +3220,6 @@ $MemoryStream.Close()
:: ::
::======================================================================================================================================== ::========================================================================================================================================
:: ::
:: If you want to use a different sppc.dll or without base64 format, then create a folder named "BIN" where this script is located and
:: place these two files in that "BIN" folder. sppc32.dll, sppc64.dll
:: Script will auto pick that instead of using the below from base64 section. You can also delete the below code in that case.
::
::========================================================================================================================================
::
:: Replace "-" with "A" and "_" with "a" before base64 conversion :: Replace "-" with "A" and "_" with "a" before base64 conversion
:: It was changed to prevent antiviruses from detecting and flagging base64 encoding :: It was changed to prevent antiviruses from detecting and flagging base64 encoding
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -68,6 +68,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -145,8 +157,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -155,10 +166,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -245,10 +254,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -257,7 +265,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -286,7 +294,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -387,11 +395,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -520,7 +528,7 @@ title Online %KS% Activation %masver%
echo: echo:
echo Initializing... echo Initializing...
call :dk_chkmal echo:
if not exist %SysPath%\%_slexe% ( if not exist %SysPath%\%_slexe% (
%eline% %eline%
@@ -1379,7 +1387,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[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% || (
@@ -1603,8 +1611,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
) )
exit /b exit /b
@@ -2271,7 +2279,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=[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)" %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)"
::======================================================================================================================================== ::========================================================================================================================================
@@ -2301,7 +2309,7 @@ exit /b
:ks_RenExport :ks_RenExport
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);"
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@@ -2666,7 +2674,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=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[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%
@@ -2964,19 +2972,19 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" if %hcount%==4 set "results=Antivirus URLs blocked in hosts file"
sc start %_slser% %nul% sc start %_slser% %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%Likely File Infector"
) || ( ) || (
if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]") if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
) )
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "Checking for Mal%w%ware Infection... [%results%]"
if defined results (call :dk_color %Red% "%results%"&set showfix=1) call :dk_color %Gray% "It is highly likely that your Windows install is infected with mal%w%ware. Windows cannot be activated."
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@@ -3337,7 +3345,7 @@ set showfix=1
set chkalp= set chkalp=
set wpainfo=NotFound set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp ( if defined chkalp (
@@ -3411,7 +3419,7 @@ set showfix=1
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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1 if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
) )
@@ -3693,7 +3701,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -77,6 +77,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -154,8 +166,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -164,10 +175,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -271,10 +280,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -283,7 +291,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -312,7 +320,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -413,11 +421,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -538,7 +546,9 @@ echo:
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color2 %_White% " [1] " %_Green% "Auto" call :dk_color2 %_White% " [1] " %_Green% "Auto"
echo Builds ^>= 26100 - StaticCID (KMS4k if offline) echo Builds ^>= 26100 - Windows only - KMS4k
echo Other options - StaticCID
echo:
echo Builds ^< 26100 - ZeroCID echo Builds ^< 26100 - ZeroCID
echo __________________________________________________ echo __________________________________________________
echo: echo:
@@ -589,7 +599,7 @@ title TSforge Activation %masver%
echo: echo:
echo Initializing... echo Initializing...
call :dk_chkmal echo:
if not exist %SysPath%\%_slexe% ( if not exist %SysPath%\%_slexe% (
%eline% %eline%
@@ -659,6 +669,9 @@ if /i %_actmethod%==KMS4k set tsmethod=KMS4k
if /i %_actmethod%==Auto ( if /i %_actmethod%==Auto (
if %winbuild% GEQ 26100 ( if %winbuild% GEQ 26100 (
set tsmethod=StaticCID set tsmethod=StaticCID
if !_actwin!==1 if not !_actwinesuoff!==1 (
set tsmethod=KMS4k
)
) else ( ) else (
set tsmethod=ZeroCID set tsmethod=ZeroCID
) )
@@ -763,7 +776,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=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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)
) )
@@ -774,7 +787,7 @@ call :dk_color %Red% "Checking Activation ID [Not Found] [%tsed
set error=1 set error=1
if /i %tsmethod%==KMS4k ( if /i %tsmethod%==KMS4k (
if /i %_actmethod%==Auto ( if /i %_actmethod%==Auto (
call :dk_color %Blue% "Connect to the Internet and try again. Script will use the StaticCID activation method." call :dk_color %Blue% "Return to the previous menu and select StaticCID activation method. Internet connection is required to activate."
) else ( ) else (
call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu." call :dk_color %Blue% "Use non-KMS4K activation options from the previous menu."
) )
@@ -1053,7 +1066,7 @@ goto :ts_esu
) )
set resetstuff=1 set resetstuff=1
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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
@@ -1092,7 +1105,7 @@ set esuexistsup=
set esueditionlist= set esueditionlist=
set esuexistbutnosup= set esuexistbutnosup=
for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1) if %winbuild% GTR 14393 for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1 if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1
if /i %tsedition%==Embedded ( if /i %tsedition%==Embedded (
@@ -1130,6 +1143,7 @@ REM Windows8.1
11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE- 11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE-
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-
1b60284a-63b5-42da-8ec9-eaab825e2bc8_Server-ESU-Year5[4-5y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10 REM Windows10
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded% f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded% 1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
@@ -1138,6 +1152,9 @@ f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuE
REM WindowsServer2016 REM WindowsServer2016
91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- 4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10LTSB2016
f2571710-2c24-4677-8fb5-a07d41d3c1aa_Client-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
22badfe6-7d55-4485-874b-7ec317442134_Client-ESU-Year6[4-6y]_-EnterpriseS-EnterpriseSN-
) do ( ) do (
for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do (
echo "%allapps%" | find /i "%%A" %nul1% && ( echo "%allapps%" | find /i "%%A" %nul1% && (
@@ -1541,10 +1558,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul%
) )
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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)
) )
@@ -1738,7 +1755,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
echo: echo:
set resetstuff=1 set resetstuff=1
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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."
@@ -1786,7 +1803,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=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[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
@@ -1936,13 +1953,13 @@ 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=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%"
if !errorlevel!==3 ( if !errorlevel!==3 (
if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%") if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
) else ( ) else (
if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 ( if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 if %_actwin%==1 (
echo: echo:
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored." call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method." if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
@@ -2221,7 +2238,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=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( for /f "delims=" %%a in ('%psc% "$f=[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!"
@@ -2342,7 +2359,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% %psc% "$sls = Get-WmiObject %sps%; $f=[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% || (
@@ -2566,8 +2583,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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
) )
exit /b exit /b
@@ -2722,7 +2739,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=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if %winbuild% GEQ 15063 %psc% "$f=[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%
@@ -2977,19 +2994,19 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\
set hcount=0 set hcount=0
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" if %hcount%==4 set "results=Antivirus URLs blocked in hosts file"
sc start %_slser% %nul% sc start %_slser% %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && (
set "results=%results%[Likely File Infector]" set "results=%results%Likely File Infector"
) || ( ) || (
if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]") if not exist %SysPath%\%_slexe% if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
) )
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [%pupfound%]"
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "Checking for Mal%w%ware Infection... [%results%]"
if defined results (call :dk_color %Red% "%results%"&set showfix=1) call :dk_color %Gray% "It is highly likely that your Windows install is infected with mal%w%ware. Windows cannot be activated."
set fixes=%fixes% %mas%remove_mal%w%ware set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
echo: echo:
@@ -3350,7 +3367,7 @@ set showfix=1
set chkalp= set chkalp=
set wpainfo=NotFound set wpainfo=NotFound
for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) for /f "delims=" %%a in ('%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a)
for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i for /f "delims=0123456789" %%i in ("%wpainfo%") do set chkalp=%%i
if defined chkalp ( if defined chkalp (
@@ -3424,7 +3441,7 @@ set showfix=1
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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1 if not defined _vis if !errorlevel! NEQ 0 set rlicfailed=1
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
) )
@@ -3706,7 +3723,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -8821,27 +8838,27 @@ namespace LibTSforge.PhysicalStore
} }
'@ '@
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$binPath = "$env:_work\BIN\LibTSforge.dll"
$psMajorVer = (Get-Host).Version.Major $psMajorVer = (Get-Host).Version.Major
$build = [System.Environment]::OSVersion.Version.Build $build = [System.Environment]::OSVersion.Version.Build
if (Test-Path -LiteralPath $binPath) { $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
Add-Type -Path $binPath $lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
}
else {
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll", "System.Xml.Linq.dll")
if ($psMajorVer -le 2) { $cp.CompilerOptions = "/define:POWERSHELL2 /unsafe" } else { $cp.CompilerOptions = "/unsafe" }
$lang = if ($psMajorVer -gt 2) { "CSharp" } else { "CSharpVersion3" }
$ctemp = "$env:SystemRoot\Temp\" $ctemp = "$env:SystemRoot\Temp\$([Guid]::NewGuid().Guid)\"
if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
$env:TMP = $ctemp $env:TMP = $ctemp
$env:TEMP = $ctemp $env:TEMP = $ctemp
$cp.GenerateInMemory = $true $cp.GenerateInMemory = $true
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
try {
$cp.TempFiles.Dispose()
} catch {
# Older .NET Framework versions do not have that method, but they also don't create the folder that it removes.
} }
Remove-Item -Path $ctemp
if ($env:_debug -eq '0') { if ($env:_debug -eq '0') {
[LibTSforge.Logger]::HideOutput = $true [LibTSforge.Logger]::HideOutput = $true
@@ -8943,7 +8960,7 @@ if (-not $env:resetstuff) {
if ($env:tsmethod -eq "KMS4k") { if ($env:tsmethod -eq "KMS4k") {
if ($build -ge 26100) { if ($build -ge 26100) {
Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
Write-Host "From build 26100.7019, Windows will always display and stay at 180 days remaining if the actual period is longer." -ForegroundColor White -BackgroundColor Darkgray Write-Host "From build 26100.7019, Windows will always display a remaining activation period of 180 days in Settings." -ForegroundColor White -BackgroundColor Darkgray
} }
else { else {
Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -200,7 +200,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -479,6 +479,19 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble
goto dk_done goto dk_done
) )
set "o_randguid="
for /f %%G in ('%psc% "[Guid]::NewGuid().Guid" ^| findstr /r "^[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*-[0123456789abcdef]*$"') do set "o_randguid=%%G"
if not defined o_randguid (
set "o_randguid="
%eline%
echo Unable to generate GUID with PowerShell.
echo Aborting...
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
goto dk_done
)
md "%SystemRoot%\Temp\%o_randguid%\"
::======================================================================================================================================== ::========================================================================================================================================
:oemenu :oemenu
@@ -567,7 +580,7 @@ cls
set editedition= set editedition=
call :ch_getinfo call :ch_getinfo
call :oe_tempcleanup call :oe_tempcleanup
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))"
:oe_editionchange :oe_editionchange
@@ -577,7 +590,7 @@ mode 98, 45
%psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=44;$B.Height=100;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul%
) )
if not exist %SystemRoot%\Temp\%list%.txt ( if not exist %SystemRoot%\Temp\%o_randguid%\%list%.txt (
%eline% %eline%
echo Failed to generate available editions list. echo Failed to generate available editions list.
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@@ -599,7 +612,7 @@ if %winbuild% LSS 10240 (
echo Unsupported products such as 2019/2021/2024 are excluded from this list. echo Unsupported products such as 2019/2021/2024 are excluded from this list.
) else ( ) else (
for %%# in (2019 2021 2024) do ( for %%# in (2019 2021 2024) do (
find /i "%%#" "%SystemRoot%\Temp\%list%.txt" %nul1% || ( find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\%list%.txt" %nul1% || (
if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#) if defined _notfound (set _notfound=%%#, !_notfound!) else (set _notfound=%%#)
) )
) )
@@ -608,7 +621,7 @@ if defined _notfound call :dk_color %Gray% "Office !_notfound! is not in this li
%line% %line%
echo: echo:
for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%list%.txt) do ( for /f "usebackq delims=" %%A in (%SystemRoot%\Temp\%o_randguid%\%list%.txt) do (
set /a counter+=1 set /a counter+=1
if !counter! LSS 10 ( if !counter! LSS 10 (
echo [!counter!] %%A echo [!counter!] %%A
@@ -640,8 +653,8 @@ 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=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))"
if not exist %SystemRoot%\Temp\getAppIds.txt ( if not exist %SystemRoot%\Temp\%o_randguid%\getAppIds.txt (
%eline% %eline%
echo Failed to generate available apps list. echo Failed to generate available apps list.
set fixes=%fixes% %mas%troubleshoot set fixes=%fixes% %mas%troubleshoot
@@ -663,7 +676,7 @@ Visio
Word Word
) do ( ) do (
if defined suites ( if defined suites (
find /i "%%#" "%SystemRoot%\Temp\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=) find /i "%%#" "%SystemRoot%\Temp\%o_randguid%\getAppIds.txt" %nul1% && (set %%#_st=On) || (set %%#_st=)
) else ( ) else (
set %%#_st= set %%#_st=
) )
@@ -673,6 +686,11 @@ if defined Lync_st set Lync_st=Off
set OneDrive_st=Off set OneDrive_st=Off
if defined suites (set Teams_st=Off) else (set Teams_st=) if defined suites (set Teams_st=Off) else (set Teams_st=)
set OutlookForWindows_st=
if %winbuild% GEQ 19041 if defined Outlook_st echo %targetedition% | find /i "O365" %nul1% && (
set OutlookForWindows_st=Off
)
:oe_excludeapps :oe_excludeapps
cls cls
@@ -685,19 +703,20 @@ call :dk_color %Gray% "To exclude the apps listed below from installation, toggl
if defined editedition call :dk_color %Gray% "Note: The On/Off status below does not reflect the current status of the installed apps." 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%
if defined Excel_st echo [E] Excel : %Excel_st% if defined Excel_st echo [E] Excel : %Excel_st%
if defined OneNote_st echo [N] OneNote : %OneNote_st% if defined OneNote_st echo [N] OneNote : %OneNote_st%
if defined Outlook_st echo [O] Outlook : %Outlook_st% if defined Outlook_st echo [O] Outlook ^(Classic^) : %Outlook_st%
if defined PowerPoint_st echo [P] PowerPoint : %PowerPoint_st% if defined PowerPoint_st echo [P] PowerPoint : %PowerPoint_st%
if defined Project_st echo [J] Project : %Project_st% if defined Project_st echo [J] Project : %Project_st%
if defined Publisher_st echo [R] Publisher : %Publisher_st% if defined Publisher_st echo [R] Publisher : %Publisher_st%
if defined Visio_st echo [V] Visio : %Visio_st% if defined Visio_st echo [V] Visio : %Visio_st%
if defined Word_st echo [W] Word : %Word_st% if defined Word_st echo [W] Word : %Word_st%
echo: echo:
if defined Lync_st echo [L] SkypeForBusiness : %Lync_st% if defined Lync_st echo [L] SkypeForBusiness : %Lync_st%
if defined OneDrive_st echo [D] OneDrive : %OneDrive_st% if defined OutlookForWindows_st echo [K] Outlook ^(New^) : %OutlookForWindows_st%
if defined Teams_st echo [T] Teams : %Teams_st% if defined OneDrive_st echo [D] OneDrive : %OneDrive_st%
if defined Teams_st echo [T] Teams : %Teams_st%
%line% %line%
echo: echo:
echo [1] Continue echo [1] Continue
@@ -705,22 +724,23 @@ echo [0] Go Back
%line% %line%
echo: echo:
call :dk_color %_Green% "Choose a menu option using your keyboard:" call :dk_color %_Green% "Choose a menu option using your keyboard:"
choice /C:AENOPJRVWLDT10 /N choice /C:AENOPJRVWLKDT10 /N
set _el=!errorlevel! set _el=!errorlevel!
if !_el!==14 goto :oemenu if !_el!==15 goto :oemenu
if !_el!==13 call :excludelist & goto :oe_editionchangefinal if !_el!==14 call :excludelist & goto :oe_editionchangefinal
if !_el!==12 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off)) if !_el!==13 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off))
if !_el!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off)) if !_el!==12 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
if !_el!==10 if defined Lync_st (if "%Lync_st%"=="Off" (set Lync_st=ON) else (set Lync_st=Off)) if !_el!==11 if defined OutlookForWindows_st (if "%OutlookForWindows_st%"=="Off" (set OutlookForWindows_st=ON) else (set OutlookForWindows_st=Off))
if !_el!==9 if defined Word_st (if "%Word_st%"=="Off" (set Word_st=ON) else (set Word_st=Off)) if !_el!==10 if defined Lync_st (if "%Lync_st%"=="Off" (set Lync_st=ON) else (set Lync_st=Off))
if !_el!==8 if defined Visio_st (if "%Visio_st%"=="Off" (set Visio_st=ON) else (set Visio_st=Off)) if !_el!==9 if defined Word_st (if "%Word_st%"=="Off" (set Word_st=ON) else (set Word_st=Off))
if !_el!==7 if defined Publisher_st (if "%Publisher_st%"=="Off" (set Publisher_st=ON) else (set Publisher_st=Off)) if !_el!==8 if defined Visio_st (if "%Visio_st%"=="Off" (set Visio_st=ON) else (set Visio_st=Off))
if !_el!==6 if defined Project_st (if "%Project_st%"=="Off" (set Project_st=ON) else (set Project_st=Off)) if !_el!==7 if defined Publisher_st (if "%Publisher_st%"=="Off" (set Publisher_st=ON) else (set Publisher_st=Off))
if !_el!==5 if defined PowerPoint_st (if "%PowerPoint_st%"=="Off" (set PowerPoint_st=ON) else (set PowerPoint_st=Off)) if !_el!==6 if defined Project_st (if "%Project_st%"=="Off" (set Project_st=ON) else (set Project_st=Off))
if !_el!==4 if defined Outlook_st (if "%Outlook_st%"=="Off" (set Outlook_st=ON) else (set Outlook_st=Off)) if !_el!==5 if defined PowerPoint_st (if "%PowerPoint_st%"=="Off" (set PowerPoint_st=ON) else (set PowerPoint_st=Off))
if !_el!==3 if defined OneNote_st (if "%OneNote_st%"=="Off" (set OneNote_st=ON) else (set OneNote_st=Off)) if !_el!==4 if defined Outlook_st (if "%Outlook_st%"=="Off" (set Outlook_st=ON) else (set Outlook_st=Off))
if !_el!==2 if defined Excel_st (if "%Excel_st%"=="Off" (set Excel_st=ON) else (set Excel_st=Off)) if !_el!==3 if defined OneNote_st (if "%OneNote_st%"=="Off" (set OneNote_st=ON) else (set OneNote_st=Off))
if !_el!==1 if defined Access_st (if "%Access_st%"=="Off" (set Access_st=ON) else (set Access_st=Off)) if !_el!==2 if defined Excel_st (if "%Excel_st%"=="Off" (set Excel_st=ON) else (set Excel_st=Off))
if !_el!==1 if defined Access_st (if "%Access_st%"=="Off" (set Access_st=ON) else (set Access_st=Off))
goto :oe_excludeapps goto :oe_excludeapps
:excludelist :excludelist
@@ -737,6 +757,7 @@ publisher
visio visio
word word
lync lync
outlookforwindows
onedrive onedrive
teams teams
) do ( ) do (
@@ -1117,7 +1138,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=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) for /f "delims=" %%a in ('%psc% "$f=[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:
@@ -1230,7 +1251,7 @@ call :oe_tempcleanup
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 goto :oemenu if !errorlevel!==2 goto :oemenu
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -1279,11 +1300,11 @@ exit /b
:oe_tempcleanup :oe_tempcleanup
del /f /q %SystemRoot%\Temp\SingleApps_Volume.txt %nul% del %SystemRoot%\Temp\%o_randguid%\SingleApps_Volume.txt %nul%
del /f /q %SystemRoot%\Temp\SingleApps_Retail.txt %nul% del %SystemRoot%\Temp\%o_randguid%\SingleApps_Retail.txt %nul%
del /f /q %SystemRoot%\Temp\Suites_Volume.txt %nul% del %SystemRoot%\Temp\%o_randguid%\Suites_Volume.txt %nul%
del /f /q %SystemRoot%\Temp\Suites_Retail.txt %nul% del %SystemRoot%\Temp\%o_randguid%\Suites_Retail.txt %nul%
del /f /q %SystemRoot%\Temp\getAppIds.txt %nul% del %SystemRoot%\Temp\%o_randguid%\getAppIds.txt %nul%
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@@ -1437,7 +1458,7 @@ if ($windowsBuild -lt 9200) {
:getlist: :getlist:
$xmlPath1 = $env:_c2rXml $xmlPath1 = $env:_c2rXml
$xmlPath2 = $env:_masterxml $xmlPath2 = $env:_masterxml
$outputDir = $env:SystemRoot + "\Temp\" $outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
$buildNumber = [System.Environment]::OSVersion.Version.Build $buildNumber = [System.Environment]::OSVersion.Version.Build
$excludedKeywords = @("2019", "2021", "2024") $excludedKeywords = @("2019", "2021", "2024")
$productReleaseIds = @() $productReleaseIds = @()
@@ -1497,7 +1518,7 @@ foreach ($section in $categories.Keys) {
:getappnames: :getappnames:
$xmlPath = $env:_masterxml $xmlPath = $env:_masterxml
$targetSkuId = $env:targetedition $targetSkuId = $env:targetedition
$outputDir = $env:SystemRoot + "\Temp\" $outputDir = $env:SystemRoot + "\Temp\$env:o_randguid\"
$outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt" $outputFile = Join-Path -Path $outputDir -ChildPath "getAppIds.txt"
$excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF") $excludeIds = @("shared", "PowerPivot", "PowerView", "MondoOnly", "OSM", "OSMUX", "Groove", "DCF")
@@ -1652,7 +1673,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -35,6 +35,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -85,8 +97,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -95,10 +106,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -164,10 +173,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -176,7 +184,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -205,7 +213,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -306,11 +314,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -468,7 +476,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=[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% 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% 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
@@ -676,7 +684,7 @@ echo:
call :ced_prep call :ced_prep
if defined preperror goto dk_done if defined preperror goto dk_done
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%"
call :ced_postprep call :ced_postprep
) )
%line% %line%
@@ -714,7 +722,7 @@ call :ced_prep
if defined preperror goto dk_done if defined preperror goto dk_done
if %_stg%==0 (set stage=) else (set stage=-StageCurrent) if %_stg%==0 (set stage=) else (set stage=-StageCurrent)
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%"
call :ced_postprep call :ced_postprep
%line% %line%
@@ -827,8 +835,8 @@ exit /b
:: https://stackoverflow.com/a/46268232 :: https://stackoverflow.com/a/46268232
set "ddf="%SystemRoot%\Temp\%Random%%Random%%Random%%Random%"" for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G"
%nul% del /q /f %ddf% set "ddf="%SystemRoot%\Temp\%Random%%randguid%""
echo/.New Cabinet>%ddf% echo/.New Cabinet>%ddf%
echo/.set Cabinet=ON>>%ddf% echo/.set Cabinet=ON>>%ddf%
echo/.set CabinetFileCountThreshold=0;>>%ddf% echo/.set CabinetFileCountThreshold=0;>>%ddf%
@@ -1091,7 +1099,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -1293,7 +1301,7 @@ if($false -eq ($installCandidates.Keys -contains $SetEdition)) {
Exit 1 Exit 1
} }
$xmlPath = $Env:SystemRoot + '\Temp' + '\CbsUpgrade.xml' $xmlPath = $Env:SystemRoot + '\Temp' + "\$([Guid]::NewGuid().Guid)CbsUpgrade.xml"
Write-UpgradeXml -RemovalCandidates $removalCandidates ` Write-UpgradeXml -RemovalCandidates $removalCandidates `
-InstallCandidates $installCandidates[$SetEdition] ` -InstallCandidates $installCandidates[$SetEdition] `
@@ -26,6 +26,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set "ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe" set "ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe"
set "_psc=%ps% -nop -c" set "_psc=%ps% -nop -c"
set "_err===== ERROR ====" set "_err===== ERROR ===="
@@ -42,7 +54,7 @@ goto :E_Exit
set "_batf=%~f0" set "_batf=%~f0"
set "_batp=%_batf:'=''%" set "_batp=%_batf:'=''%"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
%_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))" %_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))"
:E_Exit :E_Exit
echo. echo.
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -30,6 +30,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -80,8 +92,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -90,10 +101,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -175,10 +184,9 @@ goto done2
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -187,14 +195,14 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
echo You are most likely running the script directly from the archive file. echo You are most likely running the script directly from the archive file.
echo: echo:
echo Extract the archive file and launch the script from the extracted folder. echo Extract the archive file and launch the script from the extracted folder.
goto done2 goto dk_done
) )
) )
@@ -216,7 +224,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -317,11 +325,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -727,7 +735,7 @@ echo ______________________________________________________________
echo: echo:
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
@@ -804,7 +812,7 @@ exit /b
:export :export
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);" %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);"
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
+26 -18
View File
@@ -1,4 +1,4 @@
@set masver=3.10 @set masver=3.12
@echo off @echo off
@@ -30,6 +30,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set "ComSpec=%SysPath%\cmd.exe" set "ComSpec=%SysPath%\cmd.exe"
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
cd /d "%SysPath%"
:: Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
:: Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
:arg_workaround
set "_cmdf=%~f0"
exit /b
:arg_workaround_end
call :arg_workaround
set re1= set re1=
set re2= set re2=
set "_cmdf=%~f0" set "_cmdf=%~f0"
@@ -80,8 +92,7 @@ cls
:: Check LF line ending :: Check LF line ending
pushd "%~dp0" >nul findstr /v "$" "%_cmdf%" && (
>nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
@@ -90,10 +101,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 >nul ping 127.0.0.1 -n 20 >nul
popd
exit /b exit /b
) )
popd
::======================================================================================================================================== ::========================================================================================================================================
@@ -176,10 +185,9 @@ goto dk_done
set "_work=%~dp0" set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0" set "_batp=%_cmdf:'=''%"
set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%_cmdf%""" -el %_args%
set _PSarg=%_PSarg:'=''% set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
@@ -188,7 +196,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
echo "!_batf!" | find /i "!_ttemp!" %nul1% && ( echo "!_cmdf!" | find /i "!_ttemp!" %nul1% && (
if /i not "!_work!"=="!_ttemp!" ( if /i not "!_work!"=="!_ttemp!" (
%eline% %eline%
echo The script was launched from the temp folder. echo The script was launched from the temp folder.
@@ -217,7 +225,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=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[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%
@@ -318,11 +326,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal ( if defined terminal (
start conhost.exe "!_batf!" %_args% -qedit start conhost.exe "!_cmdf!" %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) else if %resetQE% EQU 1 ( ) else if %resetQE% EQU 1 (
start cmd.exe /c ""!_batf!" %_args% -qedit" start cmd.exe /c ""!_cmdf!" %_args% -qedit"
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b exit /b
) )
@@ -758,7 +766,7 @@ call :_taskclear-cache
%nul% reg query "HKLM\%SPPk%\%_wApp%" && ( %nul% reg query "HKLM\%SPPk%\%_wApp%" && (
echo Removing KMS38 protection... echo Removing KMS38 protection...
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))" %psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
%nul% reg query "HKLM\%SPPk%\%_wApp%" && ( %nul% reg query "HKLM\%SPPk%\%_wApp%" && (
call :dk_color %Red% "Failed to remove KMS38 protection." call :dk_color %Red% "Failed to remove KMS38 protection."
@@ -796,7 +804,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=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul% %psc% "$f=[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]"
@@ -866,8 +874,8 @@ if defined _vis (
echo: echo:
echo Reinstalling system licenses... echo Reinstalling system licenses...
%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[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 (
@@ -1570,7 +1578,7 @@ exit /b
:regownstart :regownstart
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));" %psc% "$f=[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
@@ -1663,7 +1671,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes ( if defined fixes (
call :dk_color %White% "Follow ALL the ABOVE blue lines. " call :dk_color %White% "Follow ALL the ABOVE blue lines. "
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore" call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 exit /b if !errorlevel!==2 exit /b
if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#)) if !errorlevel!==1 (start %selfgit% & start %github% & for %%# in (%fixes%) do (start %%#))
+2 -2
View File
@@ -80,5 +80,5 @@
--- ---
Latest Version: 3.10 Latest Version: 3.11
Release date: 19-Nov-2025 Release date: 02-May-2026