VMware Cloud Community
fitzie22
Contributor
Contributor
Jump to solution

remove hardware with command line

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,..

Reply
0 Kudos
1 Solution

Accepted Solutions
wila
Immortal
Immortal
Jump to solution

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

Reply
0 Kudos
5 Replies
NTurnbull
Expert
Expert
Jump to solution

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
Immortal
Immortal
Jump to solution

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
Reply
0 Kudos
wila
Immortal
Immortal
Jump to solution

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
Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

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
Immortal
Immortal
Jump to solution

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
Reply
0 Kudos