diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 20a5790..598eafc 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -215,7 +215,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -260,6 +260,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -283,7 +287,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -572,7 +578,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=[io.file]::ReadAllText('!_batp!'); [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\MAS_AIO.cmd', '@::RANDOM-' + [Guid]::NewGuid().Guid + [Environment]::NewLine + $f, [System.Text.Encoding]::ASCII)" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!'); [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\MAS_AIO.cmd', '@::RANDOM-' + [Guid]::NewGuid().Guid + [Environment]::NewLine + $f, [System.Text.Encoding]::ASCII)" ( echo @echo off @@ -795,7 +801,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=[io.file]::ReadAllText('!_batp!') -split ':getactivationid\:.*';iex ($f[1])"') do (set altapplist=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) if defined altapplist call :hwiddata key ) @@ -853,12 +859,15 @@ call :dk_inskey "[%key%]" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b" -set regionchange= -if not "%name%"=="US" ( +:: Skip changing region in top countries + set regionchange=1 +for %%# in (US CN IN BR DE JP GB FR MX ID IT PK TR KR CA ES AU NG VN PL PH NL EG AR TH CO SA TW MY CL) do if /i "%name%"=="%%#" set regionchange= + +if defined regionchange ( %psc% "Set-WinHomeLocation -GeoId 244" %nul% if !errorlevel! EQU 0 ( -echo Changing Windows Region To USA [Successful] +echo Changing Windows Region To USA [Successful] [Script will change it back] ) else ( call :dk_color %Red% "Changing Windows Region To USA [Failed]" ) @@ -1206,7 +1215,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=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( +if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( set winsub=1 set osSKU=%regSKU% @@ -1653,7 +1662,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -1843,7 +1852,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -2870,7 +2879,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% +%psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 echo "!allapps!" | find /i "!_actid!" %nul1% || ( @@ -3382,8 +3391,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%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% ) exit /b @@ -3719,7 +3728,7 @@ exit /b :oh_extractdll set b= -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1 +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';& ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 exit /b :hexedit: @@ -4358,7 +4367,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=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -4648,7 +4657,7 @@ goto :ts_esu ) set resetstuff=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" set resetstuff= if !errorlevel!==3 ( set error=1 @@ -5123,10 +5132,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'" %nul% +if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% ) -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -5320,7 +5329,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock... echo: set resetstuff=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" if %errorlevel%==3 ( call :dk_color %Red% "Reset Failed." @@ -5368,7 +5377,7 @@ if %errorlevel%==1 exit /b echo: echo Fetching Supported Activation IDs list. Please wait... -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':listactids\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';& ([scriptblock]::Create($f[1]))" if %errorlevel%==3 ( call :dk_color %Gray% "No supported activation ID found, aborting..." goto :dk_done @@ -5517,7 +5526,7 @@ echo Writing TrustedStore data... if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) ) echo: -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" if !errorlevel!==3 ( if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") set fixes=%fixes% %mas%troubleshoot @@ -5711,7 +5720,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k set keytype=zero ) -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) ) set "_allactid=!tsids!" @@ -12006,7 +12015,7 @@ echo: %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" %nul% reg delete "HKLM\%specific_kms%" /f ) @@ -12176,7 +12185,7 @@ echo Removing the Added Specific KMS Host [Successful] :: Protect KMS38 if opted by the user and conditions are correct if defined _k38 ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" %nul% reg delete "HKLM\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( echo Protect KMS38 From KMS [Successful] [Locked a Registry Key] @@ -12220,7 +12229,7 @@ title Remove KMS38 Protection %masver% %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" %nul% reg delete "HKLM\%specific_kms%" /f ) @@ -13999,7 +14008,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=[io.file]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)" ::======================================================================================================================================== @@ -14029,7 +14038,7 @@ exit /b :ks_RenExport -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" exit /b ::======================================================================================================================================== @@ -14783,7 +14792,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=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';& ([scriptblock]::Create($f[1]))" goto dk_done :sppmgr: @@ -16680,7 +16689,7 @@ echo Checking SPP permission related issues... call :checkperms if defined permerror ( call :dk_color %Red% "[!permerror!]" -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';iex ($f[1])" %nul% +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';& ([scriptblock]::Create($f[1]))" %nul% call :checkperms if defined permerror ( call :dk_color %Red% "[!permerror!] [Failed To Fix]" @@ -16750,8 +16759,8 @@ if defined _vis ( echo: echo Reinstalling system licenses... -%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% +if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if %errorlevel% EQU 0 ( echo [Successful] ) else ( @@ -17370,7 +17379,7 @@ exit /b :regownstart -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regown\:.*';iex ($f[1]);" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';& ([scriptblock]::Create($f[1]));" exit /b :: Below code takes ownership of a volatile registry key and deletes it @@ -17513,7 +17522,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=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) +if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( if %winbuild% GEQ 17063 call :ced_edilist @@ -17719,7 +17728,7 @@ echo: call :ced_prep if defined preperror goto dk_done -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" call :ced_postprep ) %line% @@ -17757,7 +17766,7 @@ call :ced_prep if defined preperror goto dk_done if %_stg%==0 (set stage=) else (set stage=-StageCurrent) -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" call :ced_postprep %line% @@ -18501,7 +18510,7 @@ goto :oe_edition cls call :ch_getinfo call :oe_tempcleanup -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';& ([scriptblock]::Create($f[1]))" :oe_editionchange @@ -18575,7 +18584,7 @@ cls set suites= echo %list% | find /i "Suites" %nul1% && ( set suites=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getappnames\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';& ([scriptblock]::Create($f[1]))" if not exist %SystemRoot%\Temp\getAppIds.txt ( %eline% echo Failed to generate available apps list. @@ -19056,7 +19065,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=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) echo "%build%" | find /i "16." %nul% || set build= echo: diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 3224434..d69a488 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -237,7 +237,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -282,6 +282,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -305,7 +309,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -505,7 +511,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=[io.file]::ReadAllText('!_batp!') -split ':getactivationid\:.*';iex ($f[1])"') do (set altapplist=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) if defined altapplist call :hwiddata key ) @@ -563,12 +569,15 @@ call :dk_inskey "[%key%]" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Name %nul6%') do set "name=%%b" for /f "skip=2 tokens=2*" %%a in ('reg query "HKCU\Control Panel\International\Geo" /v Nation %nul6%') do set "nation=%%b" -set regionchange= -if not "%name%"=="US" ( +:: Skip changing region in top countries + set regionchange=1 +for %%# in (US CN IN BR DE JP GB FR MX ID IT PK TR KR CA ES AU NG VN PL PH NL EG AR TH CO SA TW MY CL) do if /i "%name%"=="%%#" set regionchange= + +if defined regionchange ( %psc% "Set-WinHomeLocation -GeoId 244" %nul% if !errorlevel! EQU 0 ( -echo Changing Windows Region To USA [Successful] +echo Changing Windows Region To USA [Successful] [Script will change it back] ) else ( call :dk_color %Red% "Changing Windows Region To USA [Failed]" ) @@ -916,7 +925,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" -if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( +if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( set winsub=1 set osSKU=%regSKU% @@ -1347,7 +1356,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -1537,7 +1546,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 3e9e4d5..7b2965a 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -240,7 +240,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -285,6 +285,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -308,7 +312,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -661,7 +667,7 @@ echo: %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" %nul% reg delete "HKLM\%specific_kms%" /f ) @@ -831,7 +837,7 @@ echo Removing the Added Specific KMS Host [Successful] :: Protect KMS38 if opted by the user and conditions are correct if defined _k38 ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect" %nul% reg delete "HKLM\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( echo Protect KMS38 From KMS [Successful] [Locked a Registry Key] @@ -875,7 +881,7 @@ title Remove KMS38 Protection %masver% %nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f %nul% reg query "HKLM\%specific_kms%" && ( -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" %nul% reg delete "HKLM\%specific_kms%" /f ) @@ -1016,7 +1022,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" -if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( +if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( set winsub=1 set osSKU=%regSKU% @@ -1490,7 +1496,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -1680,7 +1686,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 93b5c80..0d5e62f 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -245,7 +245,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -290,6 +290,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -313,7 +317,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -1061,7 +1067,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% +%psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 echo "!allapps!" | find /i "!_actid!" %nul1% || ( @@ -1573,8 +1579,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%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% ) exit /b @@ -2025,7 +2031,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -2215,7 +2221,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -2890,7 +2896,7 @@ exit /b :oh_extractdll set b= -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1 +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';& ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 exit /b :hexedit: diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index eb43119..ae8808a 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -276,7 +276,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -321,6 +321,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -344,7 +348,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -1346,7 +1352,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% +%psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 echo "!allapps!" | find /i "!_actid!" %nul1% || ( @@ -1551,8 +1557,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%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% ) exit /b @@ -2214,7 +2220,7 @@ if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" / if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% call :ks_createInfo.txt -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":_extracttask\:.*`r`n\"; [io.file]::WriteAllText('%_dest%\Activation_task.cmd', '@::%randguid%' + [Environment]::NewLine + $f[1].Trim(), [System.Text.Encoding]::ASCII)" ::======================================================================================================================================== @@ -2244,7 +2250,7 @@ exit /b :ks_RenExport -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::%~3);" exit /b ::======================================================================================================================================== @@ -2610,7 +2616,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" -if %winbuild% GEQ 15063 %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( +if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( set winsub=1 set osSKU=%regSKU% @@ -3081,7 +3087,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -3271,7 +3277,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 27307cb..fd9c444 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -303,7 +303,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -348,6 +348,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -371,7 +375,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -741,7 +747,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=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -1031,7 +1037,7 @@ goto :ts_esu ) set resetstuff=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" set resetstuff= if !errorlevel!==3 ( set error=1 @@ -1506,10 +1512,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'" %nul% +if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% ) -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) ) @@ -1703,7 +1709,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock... echo: set resetstuff=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" if %errorlevel%==3 ( call :dk_color %Red% "Reset Failed." @@ -1751,7 +1757,7 @@ if %errorlevel%==1 exit /b echo: echo Fetching Supported Activation IDs list. Please wait... -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':listactids\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';& ([scriptblock]::Create($f[1]))" if %errorlevel%==3 ( call :dk_color %Gray% "No supported activation ID found, aborting..." goto :dk_done @@ -1900,7 +1906,7 @@ echo Writing TrustedStore data... if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) ) echo: -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" if !errorlevel!==3 ( if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") set fixes=%fixes% %mas%troubleshoot @@ -2169,7 +2175,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k set keytype=zero ) -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) ) set "_allactid=!tsids!" @@ -2290,7 +2296,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% +%psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 echo "!allapps!" | find /i "!_actid!" %nul1% || ( @@ -2495,8 +2501,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%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% ) exit /b @@ -2651,7 +2657,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=[io.file]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';iex ($f[1])" %nul2% | find /i "Subscription_is_activated" %nul% && ( +if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( set winsub=1 set osSKU=%regSKU% @@ -3079,7 +3085,7 @@ call :dk_color2 %Red% "Checking WinPE " %Blue% "[WinPE set wpainfo= set wpaerror= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wpatest\:.*';iex ($f[1])" %nul6%') do (set wpainfo=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) echo "%wpainfo%" | find /i "Error Found" %nul% && ( set error=1 set wpaerror=1 @@ -3269,7 +3275,7 @@ set showfix=1 if not defined notwinact ( 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index f83e68c..88fc54f 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -190,7 +190,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -235,6 +235,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -258,7 +262,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -545,7 +551,7 @@ goto :oe_edition cls call :ch_getinfo call :oe_tempcleanup -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getlist\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';& ([scriptblock]::Create($f[1]))" :oe_editionchange @@ -619,7 +625,7 @@ cls set suites= echo %list% | find /i "Suites" %nul1% && ( set suites=1 -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getappnames\:.*';iex ($f[1])" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';& ([scriptblock]::Create($f[1]))" if not exist %SystemRoot%\Temp\getAppIds.txt ( %eline% echo Failed to generate available apps list. @@ -1100,7 +1106,7 @@ if not defined terminal mode 105, 32 :: Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results set build= -for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':getbuild\:.*';iex ($f[1])" %nul6%') do (set build=%%a) +for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) echo "%build%" | find /i "16." %nul% || set build= echo: diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 905b584..05fae97 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -195,7 +195,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -240,6 +240,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -263,7 +267,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -445,7 +451,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=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) +if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( if %winbuild% GEQ 17063 call :ced_edilist @@ -651,7 +657,7 @@ echo: call :ced_prep if defined preperror goto dk_done -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" call :ced_postprep ) %line% @@ -689,7 +695,7 @@ call :ced_prep if defined preperror goto dk_done if %_stg%==0 (set stage=) else (set stage=-StageCurrent) -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" call :ced_postprep %line% diff --git a/MAS/Separate-Files-Version/Check_Activation_Status.cmd b/MAS/Separate-Files-Version/Check_Activation_Status.cmd index 728b1a0..0e865d9 100644 --- a/MAS/Separate-Files-Version/Check_Activation_Status.cmd +++ b/MAS/Separate-Files-Version/Check_Activation_Status.cmd @@ -39,7 +39,7 @@ goto :E_Exit set "_batf=%~f0" set "_batp=%_batf:'=''%" setlocal EnableDelayedExpansion -%_psc% "$f=[IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';iex ($f[1])" +%_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';& ([scriptblock]::Create($f[1]))" :E_Exit echo. diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 7fa15af..bcc3a78 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -206,7 +206,7 @@ goto done2 ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -251,6 +251,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -274,7 +278,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -816,7 +822,7 @@ exit /b :export -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('!_pdesk!\$OEM$\$$\Setup\Scripts\SetupComplete.cmd',$f[1].Trim(),[System.Text.Encoding]::ASCII);" exit /b ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index aebe72b..2989d4a 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -207,7 +207,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -252,6 +252,10 @@ echo PowerShell is not working properly. Aborting... if /i "!tstresult2!"=="FullLanguage" ( echo: echo Your antivirus software might be blocking the script, or PowerShell on your system might be corrupted. +echo: +sc query sense | find /i "RUNNING" %nul% && ( +echo Installed Antivirus - Microsoft Defender for Endpoint +) cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))}""" ) @@ -275,7 +279,9 @@ set terminal= if defined terminal ( set lines=0 -for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +for /f "skip=3 tokens=* delims=" %%A in ('mode con') do if "!lines!"=="0" ( +for %%B in (%%A) do set lines=%%B +) if !lines! GEQ 100 set terminal= ) @@ -716,7 +722,7 @@ echo Checking SPP permission related issues... call :checkperms if defined permerror ( call :dk_color %Red% "[!permerror!]" -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';iex ($f[1])" %nul% +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';& ([scriptblock]::Create($f[1]))" %nul% call :checkperms if defined permerror ( call :dk_color %Red% "[!permerror!] [Failed To Fix]" @@ -786,8 +792,8 @@ if defined _vis ( echo: echo Reinstalling system licenses... -%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% -if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% +if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% if %errorlevel% EQU 0 ( echo [Successful] ) else ( @@ -1433,7 +1439,7 @@ exit /b :regownstart -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regown\:.*';iex ($f[1]);" +%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';& ([scriptblock]::Create($f[1]));" exit /b :: Below code takes ownership of a volatile registry key and deletes it