Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Eject DVD iso from Hyper-V 2012 using PowerShell

Very short article this one. Ever tried googling/binging for how to eject the dvd-drive in Hyper-V 2012 using PowerShell? It is actually very easy and logical, and also documented in the examples.

The following Get-Help cmdlet shows you how to do this.

# Get-Help Set-VMDvdDrive -examples

Basically do the following to eject ALL your dvd-drives (first line), or use the second line to eject all dvd drives that have mounted an ISO from the E:\Install directory. You can of course also use the third line to eject from a single VM.

# Get-VM | Get-VMDvdDrive | Set-VMDvdDrive -path $null
# Get-VM | Get-VMDvdDrive | where{if($_.Path) {$_.Path.ToLower().StartsWith("e:\install\")}} | Set-VMDvdDrive -path $null
# Get-VM dc1.marius.local | Get-VMDvdDrive | Set-VMDvdDrive -path $null

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles