Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to create a VHD (virtual disk). I know this can be done with diskpart

create vdisk file C:\w7.vhd maximum 10

However I am trying to do it with PowerShell. I found the New-VHD Cmdlet, however it appears to only work with Windows 8 and I am using Windows 7. How can I use New-VHD with Windows 7, or failing that is another way available?

share|improve this question
    
Did you install PowerShell 4.0 (which is the version that command is valid for)? To get it on Windows 7 you'll need to install the Windows Management Framework 4.0. – Ƭᴇcʜιᴇ007 Apr 28 '14 at 20:21
    
@techie007 I already have that installed, no dice. – Steven Penny Apr 28 '14 at 20:51
    
I wonder if you would get the new-vhd commandlet if you installed the Hyper-V Remote Administration tools. – Zoredache Apr 28 '14 at 23:40
    
@Zoredache where is that – Steven Penny Apr 28 '14 at 23:43

An alternative that works for me is to use VirtualBox to create the VHD

create

And Windows 7 installer to format it

format

share|improve this answer

Indeed, the New-VHD CmdLet is only available for Windows Server 2012 R2 and Windows 8.1.

Info : http://technet.microsoft.com/en-us/library/hh848503.aspx

Thus, you should use diskpart or the GUI to create a VHD. Notice you can use diskpart in a script. Here are two posts that should help you :

http://www.tech-recipes.com/rx/9910/how-to-automate-windows-diskpart-commands-in-a-script/

and

http://mohamedradwan.wordpress.com/2012/02/23/create-a-vhd-and-add-it-to-the-boot-menu-using-bcdedit-command/

Hope this helps.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .