Udostępnij za pośrednictwem


Using PowerShell to mount virtual hard disks in Windows Server “8”

Yesterday I showed you how easy it is to mount virtual hard disks with Windows Explorer in Windows Server “8”.  But what if you want to script it? Don’t worry, we have you covered.

First – we have the very simple Mount-VHD command that allows you to mount a virtual hard disk.  But we can do better than that!  One of the most common questions about scripting virtual hard disk mount is: “How do I find out the drive letter that has been assigned to the virtual hard disk?”.

Well, you can do this in Windows Server “8” by running: Mount-VHD <VHD name> –passthru | Get-Disk | Get-Partition | Get-Volume

Which will give you something like this:

image

Cheers,
Ben

Comments

  • Anonymous
    October 08, 2012
    Thanks for the tips :) But I will add another question: How to always assign the same letter to the Virtual Disk ?