hi
I have 16 vm whose NIC's are connected to a vSWITCH called "vsw01".now thay all shoud change to new vswich called "vsw02".
is there any way to do it fast for all them or maybe some command . ?!
Mazixo,
If there are only 16 VMs that are connected to old portgroup, you can use the following PowerCLI command to move any VM that is connected to it:
Get-VM | Get-NetworkAdapter | Where-Object {$_.NetworkName -eq "PortgroupOld" } | Set-NetworkAdapter -NetworkName "PortgroupNew" -Confirm:$False
If there are only specific VMs that you need to move, add their names into a text file with each VM on a separate line:
Get-Content c:\SomePath\MyVMs.txt | Foreach {Get-VM $_ | Get-NetworkAdapter | Where-Object {$_.NetworkName -eq "PortgroupOld" } | Set-NetworkAdapter -NetworkName "PortgroupNew" -Confirm:$False }
what version of ESX are you using?
esxi5
read the following KB article
Mazixo,
If there are only 16 VMs that are connected to old portgroup, you can use the following PowerCLI command to move any VM that is connected to it:
Get-VM | Get-NetworkAdapter | Where-Object {$_.NetworkName -eq "PortgroupOld" } | Set-NetworkAdapter -NetworkName "PortgroupNew" -Confirm:$False
If there are only specific VMs that you need to move, add their names into a text file with each VM on a separate line:
Get-Content c:\SomePath\MyVMs.txt | Foreach {Get-VM $_ | Get-NetworkAdapter | Where-Object {$_.NetworkName -eq "PortgroupOld" } | Set-NetworkAdapter -NetworkName "PortgroupNew" -Confirm:$False }
thank you so much ! 😉