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:
1 parent
ca716d2b61
commit
1ac9221198
2 files changed
+16
-1
No files matched your search
@@ -162,7 +162,7 @@
|
|||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>1</Order>
|
<Order>1</Order>
|
||||||
<Description>Configure Windows from the answer-media script</Description>
|
<Description>Configure Windows from the answer-media script</Description>
|
||||||
<CommandLine>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"</CommandLine>
|
<CommandLine>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"</CommandLine>
|
||||||
<RequiresUserInput>false</RequiresUserInput>
|
<RequiresUserInput>false</RequiresUserInput>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ param(
|
|||||||
[switch]$InstallVirtIO,
|
[switch]$InstallVirtIO,
|
||||||
[switch]$EnableAutomaticLogon,
|
[switch]$EnableAutomaticLogon,
|
||||||
[switch]$DisableAutoUpdate,
|
[switch]$DisableAutoUpdate,
|
||||||
|
[switch]$CopyInstallers,
|
||||||
[switch]$NoPause
|
[switch]$NoPause
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -155,6 +156,17 @@ function Disable-AutomaticUpdate {
|
|||||||
-ErrorAction SilentlyContinue | Out-Null
|
-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
|
$exitCode = 0
|
||||||
try {
|
try {
|
||||||
if ($InstallVirtIO) {
|
if ($InstallVirtIO) {
|
||||||
@@ -168,6 +180,9 @@ try {
|
|||||||
if ($DisableAutoUpdate) {
|
if ($DisableAutoUpdate) {
|
||||||
Disable-AutomaticUpdate
|
Disable-AutomaticUpdate
|
||||||
}
|
}
|
||||||
|
if ($CopyInstallers) {
|
||||||
|
Copy-InstallerScripts
|
||||||
|
}
|
||||||
Write-Host 'Done.' -ForegroundColor Green
|
Write-Host 'Done.' -ForegroundColor Green
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|||||||
Reference in new issue
Block a user