Hello,
I am trying to use this to set the VirtualDeviceConnectInfo for a VM to (connected => 'false')
This doesnt work if the VM has the cdrom mounted. What happens is you have to answer a question in the vCenter to allow the overide of the lock.
my question is how can we force this and not have the question asked in vCenter?
Here is the portion of the code we are using from William Lam's vmISOManagement.pl
sub umountISO {my ($vm) = @_;my $cdrom_device = &find_cdrom_device(vm => $vm);if($cdrom_device) {my $dev_con_info = VirtualDeviceConnectInfo->new(startConnected => 'false', connected => 'false', allowGuestControl => 'false');my $cdrom_backing_info = VirtualCdromRemoteAtapiBackingInfo->new(deviceName => '');my $cdrom = VirtualCdrom->new(backing => $cdrom_backing_info, connectable => $dev_con_info, controllerKey => $cdrom_device->controllerKey, key => $cdrom_device->key, unitNumber => $cdrom_device->unitNumber);my $devspec = VirtualDeviceConfigSpec->new(operation => VirtualDeviceConfigSpecOperation->new('edit'),device => $cdrom,);my $vmspec = VirtualMachineConfigSpec->new(deviceChange => [$devspec] );eval {print "Umounting ISO from VM: \"" . $vm->name . "\" ...\n";my $task = $vm->ReconfigVM_Task( spec => $vmspec );my $msg = "\tSuccessfully unmounted ISO from VM!\n";&getStatus($task,$msg);};if($@) {print "Error: " . $@ . "\n";}} else {print "Error: Unable to umount ISO from VM: \"" . $vm->name . "\"\n";}}