The following can be used to remove a CDROM drive from a powered on Virtual Machine using vRO, vRealize Orchestrator.
Paste the following into a Scriptable task and create an input Parameter of type VC:VirtualMachine called workflowVM
var configSpec = new VcVirtualMachineConfigSpec();
var deviceConfigSpecs = new Array();
var deviceConfigSpec = new VcVirtualDeviceConfigSpec();
var devices = workflowVM.config.hardware.device;
for ( var ii in devices) {
var device = devices[ii];
if ( device instanceof VcVirtualCdrom) {
deviceConfigSpec.device = device;
deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.remove;
deviceConfigSpecs.push (deviceConfigSpec);
configSpec.deviceChange = deviceConfigSpecs
}
}
workflowVM.reconfigVM_Task(configSpec);