0

Quick Tip–Verify Which Hyper-V VMs Have ISO Mounted

It’s very common that we mount ISO files when needed, then forget to remove them after the fact.

This is generally a non issue until you want to move the mounted ISO file as Hyper-V may have a lock on the file.  Yes we could open up the properties of each VM in the console, but nope.  Not doing that.

Rather than search VMs one by one to see which is the offending VM, just run the below command in PowerShell!

 

Get-VM  | Get-VMDVDDrive  | Format-Table

Using Get-VM To List All Mounted ISO Files

 

Note that the fill path to the ISO file may not be shown.  If you just need to know which VM has an ISO mounted so you can dismount it, then you have enough.

Use the command here to dismount all ISOs using PowerShell if there are a lot.

If you do want to see the full ISO file path then we can output to Format-Table with the Autosize option so that it renders the full path to the ISO file.

Get-VM  | Get-VMDVDDrive | Select-Object VMName, Path | Format-Table -AutoSize

 

image

 

Cheers,
Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *