Make VirtIO and automatic logon opt-in in the Windows 11 configure script
Add -InstallVirtIO and -EnableAutomaticLogon switches to Configure-Windows.ps1 so it can run standalone on a physical machine. Autounattend.xml passes both switches during the virtual machine install. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1691062554
commit
96c689b03e
2 files changed
+12
-3
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"</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"</CommandLine>
|
||||||
<RequiresUserInput>false</RequiresUserInput>
|
<RequiresUserInput>false</RequiresUserInput>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
</FirstLogonCommands>
|
</FirstLogonCommands>
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
param(
|
||||||
|
[switch]$InstallVirtIO,
|
||||||
|
[switch]$EnableAutomaticLogon
|
||||||
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
@@ -91,7 +96,11 @@ function Enable-AutomaticLogon {
|
|||||||
Remove-ItemProperty -Path $winlogonPath -Name 'AutoLogonCount' -ErrorAction SilentlyContinue
|
Remove-ItemProperty -Path $winlogonPath -Name 'AutoLogonCount' -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
Install-VirtIOGuestTools
|
if ($InstallVirtIO) {
|
||||||
|
Install-VirtIOGuestTools
|
||||||
|
}
|
||||||
Install-OpenSSHServer
|
Install-OpenSSHServer
|
||||||
Install-AdministratorAuthorizedKey
|
Install-AdministratorAuthorizedKey
|
||||||
Enable-AutomaticLogon
|
if ($EnableAutomaticLogon) {
|
||||||
|
Enable-AutomaticLogon
|
||||||
|
}
|
||||||
Reference in new issue
Block a user