Jun 012013

This code will remove any mounted ISOs from a VM or set of VMs.
A VM with an ISO attached will not migrate off a host when the host is placed into Maintenance Mode or for a manual vmotion.

Single VM:
get-vm “MyVM” | get-cddrive |set-cddrive -nomedia -confirm:$false

VMs on a host:
get-vmhost “MyHost” | get-vm | get-cddrive |set-cddrive -nomedia -confirm:$false

VMs in a cluster:
get-cluster “MyCluster” | get-vm¬†| get-cddrive |set-cddrive -nomedia -confirm:$false

VMs on a datastore:
get-vm -datastore¬†“MyDatastore” | get-cddrive |set-cddrive -nomedia -confirm:$false


VMware Link: