|
|
|
@@ -3,7 +3,7 @@
|
|
|
|
|
@::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.10
|
|
|
|
|
@set masver=3.11
|
|
|
|
|
@setlocal DisableDelayedExpansion
|
|
|
|
|
@echo off
|
|
|
|
|
|
|
|
|
@@ -229,7 +229,7 @@ goto dk_done
|
|
|
|
|
|
|
|
|
|
::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" (
|
|
|
|
|
%eline%
|
|
|
|
@@ -609,7 +609,7 @@ set "_dir=!desktop!\$OEM$\$$\Setup\Scripts"
|
|
|
|
|
md "!_dir!\"
|
|
|
|
|
|
|
|
|
|
:: 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
|
|
|
|
@@ -824,7 +824,7 @@ set notworking=
|
|
|
|
|
call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
|
|
|
if defined allapps call :hwiddata 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
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -1246,7 +1246,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 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%" (
|
|
|
|
|
set winsub=1
|
|
|
|
|
set osSKU=%regSKU%
|
|
|
|
@@ -1893,7 +1893,7 @@ set showfix=1
|
|
|
|
|
|
|
|
|
|
set chkalp=
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
if defined chkalp (
|
|
|
|
@@ -1967,7 +1967,7 @@ set showfix=1
|
|
|
|
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
|
|
|
|
)
|
|
|
|
@@ -2332,7 +2332,7 @@ REM Generate ticket
|
|
|
|
|
|
|
|
|
|
if %1==ticket if "%key%"=="%%B" (
|
|
|
|
|
set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;Pfn=Microsoft.Windows.%%C.%%D_8wekyb3d8bbwe;PKeyIID=465145217131314304264339481117862266242033457260311819664735280;"
|
|
|
|
|
%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]))"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
@@ -2407,7 +2407,7 @@ $SignatureStr = SignProperties $PropertiesStr $rsa
|
|
|
|
|
$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>
|
|
|
|
|
"@
|
|
|
|
|
[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:
|
|
|
|
|
|
|
|
|
|
::========================================================================================================================================
|
|
|
|
@@ -3189,7 +3189,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do (
|
|
|
|
|
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
|
|
|
|
|
echo "!allapps!" | find /i "!_actid!" %nul1% || (
|
|
|
|
@@ -3720,8 +3720,8 @@ exit /b
|
|
|
|
|
:oh_licrefresh
|
|
|
|
|
|
|
|
|
|
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%
|
|
|
|
|
if !errorlevel! NEQ 0 %psc% "$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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
|
|
|
|
)
|
|
|
|
|
exit /b
|
|
|
|
|
|
|
|
|
@@ -4057,7 +4057,7 @@ exit /b
|
|
|
|
|
:oh_extractdll
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
:hexedit:
|
|
|
|
@@ -4097,7 +4097,7 @@ $Writer.Flush()
|
|
|
|
|
|
|
|
|
|
# Write the current state of the MemoryStream to a temporary file
|
|
|
|
|
$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())"
|
|
|
|
|
[System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
|
|
|
|
[IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray())
|
|
|
|
|
|
|
|
|
|
# Update hash using the temporary file
|
|
|
|
|
[int]$HeaderSum = 0
|
|
|
|
@@ -4120,7 +4120,7 @@ Remove-Item -Path $tempFilePath -Force
|
|
|
|
|
$modifiedBytes = $MemoryStream.ToArray()
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
if ($HeaderSum -ne $CheckSum) {
|
|
|
|
@@ -4692,7 +4692,7 @@ if defined _vis goto :ts_winvista
|
|
|
|
|
|
|
|
|
|
set tempid=
|
|
|
|
|
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)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -4982,7 +4982,7 @@ goto :ts_esu
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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=
|
|
|
|
|
if !errorlevel!==3 (
|
|
|
|
|
set error=1
|
|
|
|
@@ -5021,7 +5021,7 @@ set esuexistsup=
|
|
|
|
|
set esueditionlist=
|
|
|
|
|
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 /i %tsedition%==Embedded (
|
|
|
|
@@ -5059,6 +5059,7 @@ REM Windows8.1
|
|
|
|
|
11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE-
|
|
|
|
|
REM WindowsServer2012/2012R2
|
|
|
|
|
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
|
|
|
|
|
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
|
|
|
|
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
|
|
|
@@ -5067,6 +5068,9 @@ f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuE
|
|
|
|
|
REM WindowsServer2016
|
|
|
|
|
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-
|
|
|
|
|
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 (
|
|
|
|
|
for /f "tokens=1-3 delims=_" %%A in ("%%#") do (
|
|
|
|
|
echo "%allapps%" | find /i "%%A" %nul1% && (
|
|
|
|
@@ -5122,7 +5126,7 @@ goto :ts_off
|
|
|
|
|
set esuavail=
|
|
|
|
|
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% 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% EQU 9600 set esuavail=1
|
|
|
|
|
|
|
|
|
@@ -5470,10 +5474,10 @@ if %winbuild% GEQ 10586 (
|
|
|
|
|
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 %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)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -5667,7 +5671,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
|
|
|
|
|
echo:
|
|
|
|
|
|
|
|
|
|
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 (
|
|
|
|
|
call :dk_color %Red% "Reset Failed."
|
|
|
|
@@ -5715,7 +5719,7 @@ if %errorlevel%==1 exit /b
|
|
|
|
|
echo:
|
|
|
|
|
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 (
|
|
|
|
|
call :dk_color %Gray% "No supported activation ID found, aborting..."
|
|
|
|
|
goto :dk_done
|
|
|
|
@@ -5865,7 +5869,7 @@ echo Writing TrustedStore data...
|
|
|
|
|
if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...)
|
|
|
|
|
)
|
|
|
|
|
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 %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
|
|
|
|
|
set fixes=%fixes% %mas%troubleshoot
|
|
|
|
@@ -6068,7 +6072,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k
|
|
|
|
|
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)
|
|
|
|
|
)
|
|
|
|
|
set "_allactid=!tsids!"
|
|
|
|
@@ -13590,7 +13594,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%
|
|
|
|
|
|
|
|
|
|
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)"
|
|
|
|
|
|
|
|
|
|
::========================================================================================================================================
|
|
|
|
|
|
|
|
|
@@ -13620,7 +13624,7 @@ exit /b
|
|
|
|
|
|
|
|
|
|
: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
|
|
|
|
|
|
|
|
|
|
::========================================================================================================================================
|
|
|
|
@@ -14468,7 +14472,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% "$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
|
|
|
|
|
|
|
|
|
|
:sppmgr:
|
|
|
|
@@ -16383,7 +16387,7 @@ call :_taskclear-cache
|
|
|
|
|
|
|
|
|
|
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
|
|
|
|
echo Removing KMS38 protection...
|
|
|
|
|
%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
|
|
|
|
|
%psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))"
|
|
|
|
|
%nul% reg delete "HKLM\%SPPk%\%_wApp%" /f
|
|
|
|
|
%nul% reg query "HKLM\%SPPk%\%_wApp%" && (
|
|
|
|
|
call :dk_color %Red% "Failed to remove KMS38 protection."
|
|
|
|
@@ -16421,7 +16425,7 @@ echo Checking SPP permission related issues...
|
|
|
|
|
call :checkperms
|
|
|
|
|
if defined 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
|
|
|
|
|
if defined permerror (
|
|
|
|
|
call :dk_color %Red% "[!permerror!] [Failed To Fix]"
|
|
|
|
@@ -16491,8 +16495,8 @@ if defined _vis (
|
|
|
|
|
|
|
|
|
|
echo:
|
|
|
|
|
echo Reinstalling system licenses...
|
|
|
|
|
%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=[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=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul%
|
|
|
|
|
if %errorlevel% EQU 0 (
|
|
|
|
|
echo [Successful]
|
|
|
|
|
) else (
|
|
|
|
@@ -17115,7 +17119,7 @@ exit /b
|
|
|
|
|
|
|
|
|
|
: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
|
|
|
|
|
|
|
|
|
|
:: Below code takes ownership of a volatile registry key and deletes it
|
|
|
|
@@ -17284,7 +17288,7 @@ set _ntarget=
|
|
|
|
|
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% 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 17063 call :ced_edilist
|
|
|
|
@@ -17492,7 +17496,7 @@ echo:
|
|
|
|
|
call :ced_prep
|
|
|
|
|
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
|
|
|
|
|
)
|
|
|
|
|
%line%
|
|
|
|
@@ -17530,7 +17534,7 @@ call :ced_prep
|
|
|
|
|
if defined preperror goto dk_done
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
%line%
|
|
|
|
|
|
|
|
|
@@ -18268,7 +18272,7 @@ cls
|
|
|
|
|
set editedition=
|
|
|
|
|
call :ch_getinfo
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
@@ -18341,7 +18345,7 @@ cls
|
|
|
|
|
set suites=
|
|
|
|
|
echo %list% | find /i "Suites" %nul1% && (
|
|
|
|
|
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 (
|
|
|
|
|
%eline%
|
|
|
|
|
echo Failed to generate available apps list.
|
|
|
|
@@ -18374,6 +18378,11 @@ if defined Lync_st set Lync_st=Off
|
|
|
|
|
set OneDrive_st=Off
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
cls
|
|
|
|
@@ -18389,7 +18398,7 @@ if defined suites echo:
|
|
|
|
|
if defined Access_st echo [A] Access : %Access_st%
|
|
|
|
|
if defined Excel_st echo [E] Excel : %Excel_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 Project_st echo [J] Project : %Project_st%
|
|
|
|
|
if defined Publisher_st echo [R] Publisher : %Publisher_st%
|
|
|
|
@@ -18397,6 +18406,7 @@ if defined Visio_st echo [V] Visio : %Visio_st%
|
|
|
|
|
if defined Word_st echo [W] Word : %Word_st%
|
|
|
|
|
echo:
|
|
|
|
|
if defined Lync_st echo [L] SkypeForBusiness : %Lync_st%
|
|
|
|
|
if defined OutlookForWindows_st echo [K] Outlook ^(New^) : %OutlookForWindows_st%
|
|
|
|
|
if defined OneDrive_st echo [D] OneDrive : %OneDrive_st%
|
|
|
|
|
if defined Teams_st echo [T] Teams : %Teams_st%
|
|
|
|
|
%line%
|
|
|
|
@@ -18406,12 +18416,13 @@ echo [0] Go Back
|
|
|
|
|
%line%
|
|
|
|
|
echo:
|
|
|
|
|
call :dk_color %_Green% "Choose a menu option using your keyboard:"
|
|
|
|
|
choice /C:AENOPJRVWLDT10 /N
|
|
|
|
|
choice /C:AENOPJRVWLKDT10 /N
|
|
|
|
|
set _el=!errorlevel!
|
|
|
|
|
if !_el!==14 goto :oemenu
|
|
|
|
|
if !_el!==13 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!==11 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
|
|
|
|
|
if !_el!==15 goto :oemenu
|
|
|
|
|
if !_el!==14 call :excludelist & goto :oe_editionchangefinal
|
|
|
|
|
if !_el!==13 if defined Teams_st (if "%Teams_st%"=="Off" (set Teams_st=ON) else (set Teams_st=Off))
|
|
|
|
|
if !_el!==12 if defined OneDrive_st (if "%OneDrive_st%"=="Off" (set OneDrive_st=ON) else (set OneDrive_st=Off))
|
|
|
|
|
if !_el!==11 if defined OutlookForWindows_st (if "%OutlookForWindows_st%"=="Off" (set OutlookForWindows_st=ON) else (set OutlookForWindows_st=Off))
|
|
|
|
|
if !_el!==10 if defined Lync_st (if "%Lync_st%"=="Off" (set Lync_st=ON) else (set Lync_st=Off))
|
|
|
|
|
if !_el!==9 if defined Word_st (if "%Word_st%"=="Off" (set Word_st=ON) else (set Word_st=Off))
|
|
|
|
|
if !_el!==8 if defined Visio_st (if "%Visio_st%"=="Off" (set Visio_st=ON) else (set Visio_st=Off))
|
|
|
|
@@ -18438,6 +18449,7 @@ publisher
|
|
|
|
|
visio
|
|
|
|
|
word
|
|
|
|
|
lync
|
|
|
|
|
outlookforwindows
|
|
|
|
|
onedrive
|
|
|
|
|
teams
|
|
|
|
|
) do (
|
|
|
|
@@ -18818,7 +18830,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
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|