diff --git a/seediso/windows11/Autounattend.xml b/seediso/windows11/Autounattend.xml index 2ff5f46..3aa571f 100644 --- a/seediso/windows11/Autounattend.xml +++ b/seediso/windows11/Autounattend.xml @@ -162,7 +162,7 @@ 1 Configure Windows from the answer-media script - powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$script = Get-ChildItem -Path (Get-PSDrive -PSProvider FileSystem).Root -Filter 'Configure-Windows.ps1' -File -ErrorAction SilentlyContinue | Select-Object -First 1; if (-not $script) { throw 'Configure-Windows.ps1 was not found on the attached media.' }; & $script.FullName -InstallVirtIO -EnableAutomaticLogon -DisableAutoUpdate -NoPause" + powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$script = Get-ChildItem -Path (Get-PSDrive -PSProvider FileSystem).Root -Filter 'Configure-Windows.ps1' -File -ErrorAction SilentlyContinue | Select-Object -First 1; if (-not $script) { throw 'Configure-Windows.ps1 was not found on the attached media.' }; & $script.FullName -InstallVirtIO -EnableAutomaticLogon -DisableAutoUpdate -CopyInstallers -NoPause" false diff --git a/seediso/windows11/Configure-Windows.ps1 b/seediso/windows11/Configure-Windows.ps1 index b4c02f7..72ac0fc 100644 --- a/seediso/windows11/Configure-Windows.ps1 +++ b/seediso/windows11/Configure-Windows.ps1 @@ -2,6 +2,7 @@ param( [switch]$InstallVirtIO, [switch]$EnableAutomaticLogon, [switch]$DisableAutoUpdate, + [switch]$CopyInstallers, [switch]$NoPause ) @@ -155,6 +156,17 @@ function Disable-AutomaticUpdate { -ErrorAction SilentlyContinue | Out-Null } +function Copy-InstallerScripts { + $scripts = @(Get-ChildItem -Path $PSScriptRoot -Filter '*-Install-*.bat' -File) + if ($scripts.Count -eq 0) { + throw "No installer batch files were found next to $PSCommandPath." + } + + $target = Join-Path ([Environment]::GetFolderPath('Desktop')) 'Installers' + New-Item -ItemType Directory -Path $target -Force | Out-Null + Copy-Item -Path $scripts.FullName -Destination $target -Force +} + $exitCode = 0 try { if ($InstallVirtIO) { @@ -168,6 +180,9 @@ try { if ($DisableAutoUpdate) { Disable-AutomaticUpdate } + if ($CopyInstallers) { + Copy-InstallerScripts + } Write-Host 'Done.' -ForegroundColor Green } catch {