{% for L in ['D','E','F','G'] %} {{ L }}:\viostor\{{ win_vm_virtio_ver }}\amd64 {{ L }}:\NetKVM\{{ win_vm_virtio_ver }}\amd64 {% endfor %} {{ win_vm_ui_language }} {{ win_vm_input_locale }} {{ win_vm_system_locale }} {{ win_vm_ui_language }} {{ win_vm_user_locale }} OnError 0 true 1EFI260 2MSR16 3Primarytrue 11FAT32 22 33NTFSC 03 /IMAGE/INDEX{{ win_vm_image_index }} {{ win_vm_gvlk }}OnError true Administrator ddupan {{ win_vm_name }} {{ win_vm_input_locale }} {{ win_vm_system_locale }} {{ win_vm_ui_language }} {{ win_vm_user_locale }} true true true true Work 3 true true {{ win_vm_timezone }} {{ win_vm_admin_password }} true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <Username>Administrator</Username> <Password><Value>{{ win_vm_admin_password }}</Value><PlainText>true</PlainText></Password> </AutoLogon> <FirstLogonCommands> <SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <Order>1</Order> <Description>Static IP + DNS</Description> <CommandLine>powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;$i=(Get-NetAdapter | Where-Object Status -eq 'Up' | Select-Object -First 1).ifIndex; New-NetIPAddress -InterfaceIndex $i -IPAddress {{ win_vm_ip }} -PrefixLength {{ win_vm_prefix }} -DefaultGateway {{ win_vm_gateway }}; Set-DnsClientServerAddress -InterfaceIndex $i -ServerAddresses {{ win_vm_dns }}&quot;</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <Order>2</Order> <Description>Enable WinRM + HTTPS listener (self-signed)</Description> <CommandLine>powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;Enable-PSRemoting -Force; $c=New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation Cert:\LocalMachine\My; New-Item -Path WSMan:\localhost\Listener -Address * -Transport HTTPS -CertificateThumbPrint $c.Thumbprint -Force&quot;</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <Order>3</Order> <Description>Firewall: allow WinRM HTTPS 5986</Description> <CommandLine>powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;New-NetFirewallRule -DisplayName 'WinRM HTTPS' -Direction Inbound -Protocol TCP -LocalPort 5986 -Action Allow&quot;</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <Order>4</Order> <Description>Enable Remote Desktop + firewall group</Description> <CommandLine>powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0; Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1; Enable-NetFirewallRule -Group '@FirewallAPI.dll,-28752'&quot;</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <Order>5</Order> <Description>Install virtio-win guest tools (drivers + QEMU guest agent + balloon)</Description> <CommandLine>powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;$e=(Get-PSDrive -PSProvider FileSystem | ForEach-Object { Join-Path $_.Root 'virtio-win-guest-tools.exe' } | Where-Object { Test-Path $_ } | Select-Object -First 1); if ($e) { Start-Process $e -ArgumentList '/install','/quiet','/norestart' -Wait }&quot;</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> </unattend>