Contact
Line : comsiam
Contact
Line : comsiam

การสร้าง VM ด้วย PowerShell คือหนึ่งในทักษะสำคัญของสาย System Admin และ Infrastructure เพราะช่วยให้:
ในองค์กรจริง การสร้าง VM ผ่าน GUI ทีละเครื่อง:
Windows Server 2025 พัฒนา Hyper-V PowerShell Module ให้รองรับ Modern Infrastructure ได้ดีขึ้นมาก ทั้ง:
บทความนี้จะสอนวิธีสร้าง VM ด้วย PowerShell แบบละเอียด ตั้งแต่พื้นฐานจนถึงการสร้าง VM พร้อมใช้งานจริง
ช่วย:
คือหัวใจของ:
เปิด:
Windows PowerShell
หรือ:
Windows Terminal
แนะนำ:
ใช้:
Get-VM
ใช้:
New-VM
New-VM -Name "VM01"
ใช้:
New-VM -Name "VM01" -MemoryStartupBytes 4GB
ใช้:
-Generation 2
ใช้:
สำหรับ VM ยุคใหม่
ใช้:
-SwitchName "ExternalSwitch"
ใช้:
-NewVHDPath "D:\VM\VM01.vhdx"
ใช้:
-NewVHDSizeBytes 100GB
New-VM -Name "VM01" `
-MemoryStartupBytes 4GB `
-Generation 2 `
-NewVHDPath "D:\VM\VM01.vhdx" `
-NewVHDSizeBytes 100GB `
-SwitchName "ExternalSwitch"
ใช้:
Set-VMProcessor -VMName "VM01" -Count 4
ใช้:
Set-VMMemory -VMName "VM01" -DynamicMemoryEnabled $true
ใช้:
Set-VMDvdDrive
Set-VMDvdDrive -VMName "VM01" -Path "D:\ISO\Windows11.iso"
ใช้:
Set-VMFirmware -VMName "VM01" -EnableSecureBoot On
ใช้:
Enable-VMTPM -VMName "VM01"
ใช้:
Start-VM -Name "VM01"
ใช้ Loop:
1..10 | % { New-VM }
ตัวอย่าง:
"LAB-VM$_"
สามารถ:
ได้
ใช้:
Measure-VM
ใช้:
Export-VM
ใช้:
Remove-VM
ชื่อ Switch ผิด
Folder ไม่มี
ไม่ได้ Run as Admin
ช่วย:
การสร้าง VM ด้วย PowerShell คือพื้นฐานสำคัญของ Hyper-V Automation และ Infrastructure ยุคใหม่ เพราะช่วยให้สามารถ Deploy VM ได้เร็ว, แม่นยำ และ Scale ได้ง่าย
Windows Server 2025 พัฒนา Hyper-V PowerShell ให้รองรับ Modern Infrastructure ได้ดีขึ้นมาก ทั้ง AI VM, GPU VM และ Automation Workflow
สำหรับสาย System Admin และ Infrastructure การสร้าง VM ด้วย PowerShell ถือเป็นทักษะสำคัญระดับ Enterprise เพราะ Data Center ยุคใหม่แทบทั้งหมดใช้ Automation ในการบริหาร VM แล้ว
comsiam มองว่า “คนที่สร้าง VM ด้วย Script ได้” จะทำงาน Infrastructure ได้เร็วและ Scale ระบบได้เหนือกว่าการใช้ GUI อย่างเดียวหลายเท่า