In this article I will explain how you can easily identify and disconnect connected CD drives from VM’s on VMware vSphere using a simple PowerCLI command.
Connected CD drives can cause issues when you for example want to remediate your VMware vSphere cluster using the Update Manager.

Find and disconnect all CD drives from VM’s
The first step is to connect to the vCenter server, using the Connect-VIServer command,
The second line of code will identify which VM’s have a mounted CD drive.
All VM’s with a mounted CD drive have a value in the IsoPath:
Get-VM | Where-Object {$_.PowerState –eq “PoweredOn”} | Get-CDDrive | FT Parent, IsoPath
The third line of code will select all VM’s and change the state of the media to No Media.
Get-VM | Where-Object {$_.PowerState –eq “PoweredOn”} | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$False
Now, run the first command again.
After running the command, you will see that the ISOPath for all VM’s is empty now.

Good luck!
Other PowerCLI related blogs can be found here
11,557 total views, 13 views today