PowerCLI one-liner: remove the VMware tools mounted ISO

When you do an “Automatic Tools Upgrade” on a virtual machine the VMware tools iso will be mounted into the VM. Unfortunately it sometimes happens that after the upgrade the iso stays attached and this will result in a warning while doing a manual VMotion.

When you inspect the VM (edit settings) you will see the ISO being mounted.

You can change this to Client Device and the ISO will be unmounted and the warning won’t be shown anymore. Obviously this isn’t something you want to do manually on all your VMs and therefor the following PowerCLI one-liner will help you.

Get-VM | Get-CDDrive | Where { $_.IsoPath } | Set-CDDrive -NoMedia -Confirm:$false
Niels Engelen
Working as a pre-sales with an interest for anything virtual and cloud. Certified as a VMware Certified Professional 4 and 5. Niels also gained the VMware vExpert award (2012-2016) and is an ex-PernixPro.