You can connect and disconnect virtual devices by using the connectdevice and disconnectdevice options of vmware-cmd.
The following types of devices are supported.
- Network adapters
- CD/DVD drives
- Floppy drives
These devices must already be defined in the virtual machine virtual hardware list.
The command options connect and disconnect a defined ISO or FLP file or a physical device on the host. After you connect a device, its content can be accessed from the guest OS. For network adapters, the options connect the virtual NIC to its defined port group or disconnect the NIC. This is equivalent to selecting or deselecting the Connected check box in the vSphere Web Client.
CD/DVD drive
,
Floppy drive
. and
Network adapter
are case-sensitive.
You can connect or disconnect devices if the following conditions are met.
- The virtual machine has a guest operating system that supports hot-plug functionality. See the Operating System Installation documentation.
- The virtual machine is using hardware version 7 or later.
- The virtual machine is powered on.
The following examples illustrate connecting and disconnecting a virtual device. Device names are case sensitive.
- The connectdevice option connects the virtual IDE device CD/DVD Drive 2 to the specified virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx connectdevice "CD/DVD drive 2"
- The disconnectdevice option disconnects the virtual device.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx disconnectdevice "CD/DVD drive 2"