PowerShell, Hyper-V: List clustered VMs with mounted ISO, then dismount them all.

There is nothing more annoying than when people leave ISO's mounted to VM's. It drives me mad.This little script will list machines that have ISO's mounted and then if you like you bulk unmount them. Enjoy

This will just list all your VM's and show you the status od the DVD drive :

$clusternodes = Get-ClusterNode

ForEach ($clusternode in $clusternodes)
{get-VM -ComputerName $clusternode.Name | Get-VMDvdDrive }`

If you want to bulk unmount them its the same command with a little bit at the end

$clusternodes = Get-ClusterNode

ForEach ($clusternode in $clusternodes)
{get-VM -ComputerName $clusternode.Name | Get-VMDvdDrive | Set-VMDvdDrive -Path $null}`

This will recurse through ever node in your cluster, so if you have a large environment, don't panic, it will take a while.