This might take you < 1 minute to read.

I had a minor issue with lingering ISOs in an VMM-environment. The issue wasn’t a technical one but a “soft” one. The users admins of the environment did not unmount ISOs after usage. So I created a small script that is triggered once a day and unmounts all ISOs that is more than a week old.

$VMMServer = "yourVMMServer"
Get-VirtualDVDDrive -VMMServer $VMMServer -All | Where-object {($_.ISO -ne $null) -and ($_.ISOLinked -eq $false) -and $_.addedtime.date.adddays(7) -lt (get-date)}| Set-VirtualDVDDrive –NoMedia

There is no magic in this script. It does just what it looks like. Iterate through all Virtual drives and gets the “addedtime” and checks if it older than 7 days. If so set virtual drive to -null.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.