CD Connected to Another Client

While trying to VMotion a VM I hit an error because of a Mounted CD. Well you might say – that is simple. Just go into the GUI and then disconnect it.

But this time it was connected  and open in another users sessions so I got this


The reason I think this was happenning was because of the other user still having a console session open to the VM with the CD mounted.

This post on VMTN spoke about a perl script that would allow you to disconnect – but I thought why not try with PowerCLI

get-vm myvm | Get-CDDrive | Set-CDDrive -Connected:$false -confirm:$false

That disconnected the CD and allowed me to VMotion the machine without any issues.