Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
Easily eject ISOs from all virtual machines in a cluster.
May 12, 2014
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-VMforeach ($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.
You May Also Like