VMM 2016 (Virtual Machine Manger) - Unmount All ISO's

VMM 2016 (Virtual Machine Manger) – Unmount All ISO’s

After upgrading our VMM server from 2012 to 2016. I wanted to restructure our ISO library a bit. Before I did this I wanted to see what VMs had images mounted in our Hyper-V estate, as moving ISO’s would cause issues if already mounted. The script below simply finds all VMs with mounted ISO’s and unmounts them. Although this is written for VMM 2016, it will likely work for 2012.