PowerTip: Use PowerShell to Eject DVDs from Group of Virtual Machines

Summary: Use Windows PowerShell to eject the DVDs from a group of virtual machines.

Hey, Scripting Guy! Question How can I eject any mounted DVDs from a group of virtual machines that are running Hyper-V in Windows Server 2012?

Hey, Scripting Guy! Answer Use the Set-VMDvdDrive cmdlet and set the path to $null:

$name = "Client1","Server1","Server2"

$name | Foreach {Set-VMDvdDrive -VMName $_ -Path $null}

Comments (0)

Skip to main content