Download file remotely and then download requirements remotely

This commit is contained in:
MrMeeb 2024-08-06 18:26:08 +01:00
parent 74648459f4
commit d5e4f29963
Signed by: MrMeeb
GPG Key ID: 3864A01CC606E310
2 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,9 @@
@echo off
xcopy "%~dp0\Boot" "C:\boot\" /s /e /h /q /y
xcopy "%~dp0\boot.wim" "C:\sources\" /h /q /y
cd "%~dp0"
powershell -executionpolicy bypass -file "setuppe.ps1"
set StagingDir=%TEMP%\SRBW
set RemoteURL="https://git.mrmeeb.stream/MrMeeb/sure-recover-boot-wiper/raw/branch/main/payload"
mkdir %StagingDir%
powershell -Command Invoke-WebRequest %RemoteURL%/run.ps1 -OutFile %StagingDir%\run.ps1
powershell -ExecutionPolicy bypass -File %StagingDir%\run.ps1 %RemoteURL%

View File

@ -1,18 +1,19 @@
$RemoteURL = "https://git.mrmeeb.stream/MrMeeb/sure-recover-boot-wiper/raw/branch/main/payload"
$StagingDir = "$TEMP\SRBW"
$RemoteURL = $args[0]
$StagingDir = $PSScriptRoot
Write-Host $RemoteURL
# Make staging directory
mkdir -Path $StagingDir
#Disable progress bars to make Invoke-WebRequest actually fast
$ProgressPreference = 'SilentlyContinue'
# Download compressed boot dir to Staging Dir
Invoke-WebRequest -Uri $RemoteURL/boot.zip -OutFile $StagingDir\boot.zip
# Expand boot.zip to C:\Boot
Expand-Archive -Path $StagingDir\boot.zip -DestinationPath C:\boot
Expand-Archive -Path $StagingDir\boot.zip -DestinationPath C:\boot -Force
# Download WinPE wim to C:\Sources\boot.wim
mkdir -Path C:\Sources
New-Item -ItemType "Directory" -Path C:\Sources -Force
Invoke-WebRequest -Uri $RemoteURL/boot.wim -OutFile C:\Sources\boot.wim
@ -74,4 +75,6 @@ function BootToPE {
bcdedit /bootsequence $LTGUID
shutdown /r /f /t 0
}
}
Remove-Item -Path $StagingDir -Recurse