How do I connect/disconnect a CDROM drive from a virtual machine from the command-line? I don't see anything in the VIX reference.
1 Answer
You can do this with the vmware-vim-cmd line tool. For example, if your VM is vmid 112, and the CDROM deviceKey is 3002, the command will be:
vmware-vim-cmd vmsvc/device.connection 112 3002 true
You can discover the vmid with the command:
vmware-vim-cmd vmsvc/getallvms
Then you can find the device ID with the command:
vmware-vim-cmd vmsvc/device.getdevices <vmid>
-
On my VMWare Server 2.0 installation on a Windows Server 2003 machine, I can't find vmware-vim-cmd. Which directory is it installed in by default?– ristonjSep 27, 2011 at 21:23
-
I'm not sure, I don't have a Windows machine with Server installed on it to look around. Maybe something in
c:\program Files\VMware
? You could also look for vimsh.exe or any vmware-*.exe to find possible locations. Sep 27, 2011 at 21:52 -
I searched the entire hard drive and didn't find vmware-vim-cmd. I don't think it comes with the Windows version of VMWare Server.– ristonjSep 28, 2011 at 15:00