IHAC for some reason need to make all the VM's vnic in "disconnect" status for few second and then back to "connected", so need to find ways to disconnect all the vNICs in batch or disalbe the vSwitch. Seems vicfg-vswitch can't help on this. Any suggestion would be appreciated!
Hi,
I think, it's possible by using PowerCLI.
You can use this command: Set-NetworkAdapter - vSphere PowerCLI Cmdlets Reference
Powercli is your best solutions, just keep in mind if you are running vcenter as vm then you are basically shooting yourself in the foot, and also think about other core infrastructure servers. vDS has option to disable individual ports on the vDS switch.
If you are ok with logging into the guest to disable/enable its vNICs, vmware-toolbox-cmd can help. This will be available only if you have installed VMware Tools in the Guest OS (Linux/Windows).
E.g. run below commands in the Guest OS:
~ # vmware-toolbox-cmd device disable Ethernet0 <or the vNICs you want to disconnect>
~ # vmware-toolbox-cmd device enable Ethernet0
To get the vNIC numbers do a device list.
VM configuration might need to be changed to allow access to the devices. Please refer to: vSphere Documentation Center
---
Or, from the ESXi host:
~ # vim-cmd vmsvc/device.connection <vmid> <device key> <connect/disconnect>
To get vmid:
vim-cmd vmsvc/getallvms
To get device key:
vim-cmd vmsvc/device.getdevice