Search This Blog

Monday, April 1, 2013

Dismount ISO or DVD From the VM By Using Powershell

 

Getting a bit tired of checking which VMs are having iso mounted and still cannot figure out why people forget to dismount the iso from the VM after using it.

Imagine you got 20 , 30, 40 or 100 VM in your environment. Are you going to use GUI to check each one of them. Well, I’m a bit lazy so the faster way to achieve this is by using Powershell.

Get-VMDvdDrive –Vmname *

This will display the entire VM which is connected to DVD. For those VMs that is not connected to iso will be displayed as “None” on the DvdMediaType Path. My example below shown 2 VMs are connected to iso and listed Controller Number and Controller Location of the DVD Drive.

1

Next step, how to remove the iso/dvd the faster way without using GUI after identified which VMs having the iso?

Set-VMDvdDrive –VmName Red-SQL –ControllerNumber 1 – ControllerLocation 0 –Path $null

2

The command will connect to the VM and eject the DVD/iso from the VM.

View the result again by typing the command Get-VMDvdDrive

3

Thanks to Powershell, I can faster dismount the DVD/ISO from the VM.

2 comments:

  1. This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you. You definitely put a new spin on a topic thats been written about for years. Great stuff, just great! 35mm silde scanning service

    ReplyDelete