
ในการติดตั้ง Windows บนระบบ Virtualization อย่าง KVM,Proxmox หรือ Nutanix หลายคนอาจเจอกับปัญหาที่ Windows มองไม่เห็น disk หรือ network interface เนื่องจากไม่มี VirtIO drivers ติดตั้งมาให้โดยตรงใน ISO ของ Microsoft โดยเฉพาะกับ Windows Server เวอร์ชันใหม่ ๆ ที่ต้องใช้ไดรเวอร์เฉพาะเพื่อเชื่อมต่อกับ Virtual Disk และ Network
วิธีแก้ที่พบกันบ่อยคือการ mount ไฟล์ VirtIO ISO แยกแล้วติดตั้งไดรเวอร์ระหว่างการ setup — แต่ขั้นตอนเหล่านี้เสียเวลา และอาจทำให้การ deploy VM แบบอัตโนมัติซับซ้อนมากขึ้น
บทความนี้จะพาไปรู้จักกับวิธีการสร้างไฟล์ Windows installation แบบ custom ที่มีการฝัง VirtIO drivers ลงไปในไฟล์ .wim
ทั้ง boot.wim
และ install.wim
ทำให้ ISO ที่ได้สามารถติดตั้ง Windows บน VM ได้ทันทีโดยไม่ต้อง mount อะไรเพิ่ม พร้อมรองรับทั้ง UEFI และ BIOS boot แบบครบวงจรสามารถดูขั้นตอนและวิธีการจากบทความด้านล่างได้เลยครับ
ขั้นตอนการสร้างไฟล์ Windows installation โดย built-in VirtIO
1.ทำการ mount ไฟล์ ISO ของ Windows ที่ต้องการและ ISO ของ VirtIO เข้าเครื่องคอมพิวเตอร์ของเราซึ่งในที่นี่จะเห็นว่าตัวWindows ISO image จะเป็นไดร์ D: ส่วน Nutanix VirtIO image เป็นไดร์ E:
2.ทำการเปิด PowerShell โดยเปิดด้วย Administrator และใช้คำสั่ง: mkdir C:\VirtIO\windows_temp,C:\VirtIO\mount_boot,C:\VirtIO\mount_install เพื่อสร้างโฟลเดอร์ที่ใช้เป็น temp ขึ้นมา
ทำการคัดลอกไฟล์ Windows Image ทั้งหมดมายัง windows_temp โดยใช้คำสั่ง: Copy-Item D:\* C:\VirtIO\windows_temp\ -Recurse
เปลี่ยนสิทธิ์การอ่านเขียนไฟล์ที่เป็น.wim โดยการนำ attribute Read-only ออกจากไฟล์โดยใช้คำสั่ง: attrib -r C:\VirtIO\windows_temp\sources\*.wim /s
3.ทำการแทรกไฟล์VirtIO drivers ลงใน boot.wim โดยใช้คำสั่ง: Get-WindowsImage -ImagePath C:\VirtIO\windows_temp\sources\boot.wim เพื่อดูค่า Index ของ Microsoft Windows Setup ใน boot.wim
mount ไฟล์ .wim ไปยังโฟเดอร์ mount_boot เพื่อทำการแทรกไฟล์VirtIO drivers ใช้คำสั่ง: Mount-windowsImage -Path C:\VirtIO\mount_boot\ -ImagePath C:\VirtIO\windows_temp\sources\boot.wim -Index 2
เพิ่ม drivers เข้าไปใน Windows image (.wim) ที่ถูก mount เอาไว้ใช้คำสั่ง: Add-WindowsDriver -Path C:\VirtIO\mount_boot\ -Driver “E:\Windows Server 2025” -Recurse
ยกเลิกการ mount image ที่ถูก mount ไว้บันทึกการเปลี่ยนแปลงที่ทำไว้ใน image ใช้คำสั่ง: Dismount-windowsImage -Path C:\VirtIO\mount_boot\ -Save
4.ทำการแทรกไฟล์VirtIO drivers ลงใน install.wim โดยใช้คำสั่ง: Get-WindowsImage -ImagePath C:\VirtIO\windows_temp\sources\install.wim เพื่อดูค่า Index ของ Windows Editions ใน install.wim ที่ต้องการติดตั้ง drivers โดยในที่นี่จะเลือกเป็น Windows Server 2025 Standard Evaluation (Desktop Experience) ที่มีค่า Index 2
mount ไฟล์ .wim ไปยังโฟเดอร์ mount_install เพื่อทำการแทรกไฟล์ VirtIO drivers ใช้คำสั่ง: Mount-WindowsImage -Path C:\VirtIO\mount_install\ -ImagePath C:\VirtIO\windows_temp\sources\install.wim -Index 2
เพิ่ม drivers เข้าไปใน Windows image (.wim) ที่ถูก mount เอาไว้ใช้คำสั่ง: Add-WindowsDriver -Path C:\VirtIO\mount_install\ -Driver “E:\Windows Server 2025” -Recurse
ยกเลิกการ mount image ที่ถูก mount ไว้บันทึกการเปลี่ยนแปลงที่ทำไว้ใน image ใช้คำสั่ง: Dismount-WindowsImage -Path C:\VirtIO\mount_install\ -Save
5.สร้างไฟล์ Windows ISO image โดยใช้ตัว Deployment and Imaging Tools Environment และใช้คำสั่ง: oscdimg -m -o -u2 -udfver102 -lWINSERV2025_virtio -bC:\VirtIO\windows_temp\boot\etfsboot.com -bootdata:2#p0,e,bC:\VirtIO\windows_temp\boot\etfsboot.com#pEF,e,bC:\VirtIO\windows_temp\efi\microsoft\boot\efisys.bin C:\VirtIO\windows_temp\ C:\VirtIO\WINSERV2025_VirtIO.iso สร้าง ISO bootable ที่รองรับทั้ง UEFI และ BIOS boot
เมื่อนำไฟล์ ISO ไปใช้งานก็สามารถมองเห็น Disk ได้เลยโดยไม่ต้อง Mount และติดตั้ง VirtIO drivers ใหม่อีกครับ
อ้างอิง: How to create Windows installation ISO with built-in VirtIO drivers