Q: How can I eject the ISO files from all DVD drives attached to virtual machines in a cluster?

A: The following PowerShell code will eject the ISO files from all virtual machines in a cluster.

$VMsinCluster = Get-ClusterResource | Where-Object {$_.ResourceType -eq "Virtual Machine"} | Get-VM

foreach ($VM in $VMsinCluster)
{
    $VMDrive = Get-VMDvdDrive -VM $VM
    if ($VMDrive.DvdMediaType -eq "ISO")
    {
        Write-Host "Removing ISO from" $VMDrive.VMName
        Get-VMDvdDrive -VM $VM | Set-VMDvdDrive -Path $null
    }
}

Just run this PowerShell code in the cluster, and ISO files will be ejected from all virtual machines in the cluster.