fitzie22
Contributor
Contributor

remove hardware with command line

Jump to solution

I have a vm that is powered on and in a cluster and I need to migrade it. it currently has a cdrom installed but I can't edit it(cdrom is greyed out) Is there a way to remove these devices from the vm in VC with a command line so I can migrate it? (really it is just the cdrom that is holding it up. Ohh and the kicker is I can't reboot the vm,..

0 Kudos
1 Solution

Accepted Solutions
wila
Leadership
Leadership

Hi,

I have no 3.0 version of ESX running down here anymore, but you can try to do this using vimsh as follows:

Connect to the Console on your ESX host and enter as root:

vimsh

Now get the ID of your VM in question using (scroll using shift page up / page down if you have to)

vmsvc/getallvms

write down the VM ID for example it can be a number like 4400

Find the key for your VirtualCDrom by querying the hardware devices for your VM.

vmsvc/device.getdevices 4400

scroll up again and write down the Key, in my case it is 3000

Now disconnect the CDrom device by running:

vmsvc/device.connection 4400 3000 false

Use true if you want to connect the device.

Just tested this on VMware ESX3.5 and it worked fine there.



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva

View solution in original post

0 Kudos
5 Replies
NTurnbull
Expert
Expert

Hi, as far as I know, no. Its down to the type of device - IDE device being presented to the vm. Try changing the cd-rom to point to an iso thats available to both ESX boxes

Thanks,

Neil

Thanks, Neil
wila
Leadership
Leadership

Hi,

I have no 3.0 version of ESX running down here anymore, but you can try to do this using vimsh as follows:

Connect to the Console on your ESX host and enter as root:

vimsh

Now get the ID of your VM in question using (scroll using shift page up / page down if you have to)

vmsvc/getallvms

write down the VM ID for example it can be a number like 4400

Find the key for your VirtualCDrom by querying the hardware devices for your VM.

vmsvc/device.getdevices 4400

scroll up again and write down the Key, in my case it is 3000

Now disconnect the CDrom device by running:

vmsvc/device.connection 4400 3000 false

Use true if you want to connect the device.

Just tested this on VMware ESX3.5 and it worked fine there.



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva

View solution in original post

0 Kudos
wila
Leadership
Leadership

Oh I forgot use "quit" if you want to stop vimsh or go to

http://www.vi-toolkit.com/wiki/index.php/Vimsh

for more info on vimsh.



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
lamw
Community Manager
Community Manager

As Wila has stated you can use the "vimsh", on ESX 3.0.x+ you'll need to use the following syntax:

vimsh -n -e "command ..."

For ESX 3.5+ use the following:

vmware-vim-cmd "command ..."

For ESXi 3.5+ use the following"

vim-cmd "command ..."

wila
Leadership
Leadership

Hey thanks for that... I added the vim-cmd bit to the vimsh landing page on vi-toolkit.com

--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos