Add autounattend.xml download if missing

Implement a check for the existence of `autounattend.xml`. If the file is not found, download it from a specified URL using `Invoke-RestMethod` and save it to the script's root directory. This ensures the configuration file is available for the script's execution.
This commit is contained in:
Miiraak
2025-08-31 12:32:36 +02:00
parent 5da84b9737
commit 9af52a8206

View File

@@ -99,7 +99,9 @@ if (! $myWindowsPrincipal.IsInRole($adminRole))
exit
}
if (-not (Test-Path -Path "$PSScriptRoot/autounattend.xml")) {
Invoke-RestMethod "https://raw.githubusercontent.com/ntdevlabs/tiny11builder/refs/heads/main/autounattend.xml" -OutFile "$PSScriptRoot/autounattend.xml"
}
# Start the transcript and prepare the window
Start-Transcript -Path "$ScratchDisk\tiny11.log"