Copy the installer batch files to an Installers folder on the desktop

Adds a -CopyInstallers switch to the Windows 11 configure script and enables
it in Autounattend.xml.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GuofangandClaude Sonnet 5.5 committed 2026-10-16 13:58:41 +08:00
1 parent ca716d2b61
commit 1ac9221198
2 files changed
+16 -1

No files matched your search

+15
View File
@@ -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 {