Fix can’t Remove Host from Distributed Switch in VMware vCenter

Network บน VMware จะมีอยู่ 2 แบบ คือ Standard Switch และ Virtual Distributed Switch ( VDS ) ซึ่งก็มีข้อดีข้อเสียแตกต่างกันไป แต่ถ้าหากใช้เป็น VDS จะทำให้ไม่สามารถ Remove Host ออกจาก VDS ได้หากมี VM ที่อยู่บน Host ถูกใช้งานอยู่ซึ่งรวมถึง VM Offline ด้วย ทางแก้คือต้องย้าย Network ของ Management และ VM ที่อยู่บน Host ทั้งหมดไปใช้ Standard Switch แต่ในที่นี้ผมจะพูดถึงการลบ Network ของ VM หลาย ๆ ตัวที่เป็น Backup โดยใช้ Powershell ถ้าเป็นการย้ายไม่แนะนำกับระบบที่ออนไลน์อยู่ เพราะอันตรายอาจทำให้ระบบที่ออนไลน์อยู่ทำงานผิดพลาด


Configuration

  • สร้าง Remove-NIC.ps1 แล้วสั่งรัน
. "$PSScriptRoot\Configuration.ps1"
Connect-VIServer -Server $server -Credential $credential

$nic = Get-NetworkAdapter -VM 'Backup-*'
Remove-NetworkAdapter -NetworkAdapter $nic

Disconnect-VIServer -Server $server -Confirm:$false
  • หลังจากนั้น Remove Host ออกจาก VDS โดยคลิกขวาบน VDS เลือก Add and Manage Hosts แล้วเลือก Remove hosts
  • เลือก Host ที่จะลบ VDS แล้วคลิก Next แล้วกด Finish

Leave a Reply

Your email address will not be published. Required fields are marked *