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

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

  • Comments 1


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

Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post
  • Thanks for the tips :)

    But I will add another question: How to always assign the same letter to the Virtual Disk ?

Page 1 of 1 (1 items)