I believe in Hyper-V!

Create New Generation 2 Virtual Machine with PowerShell – fundamentals

In this blog post I’d like to explain how to create Generation 2 Virtual Machine in few seconds with PowerShell. This .ps1 script is a very simple and you can create just one VM but you can edit it for your needs.
In the last two years on my lectures I noticed that many of attendees don’t understand the basics and also they are ashamed to ask in the front of other attendees. For that reason I want to help them!

This is my way how to create VM. I used PowerShell ISE for the better look

Step 1.

1

Step 2.

Type command like in the picture below, edit what you need to edit and press Run Script (F5).

2

### create client generation 2 virtual machine ###
New-VM -Name ATDGen2 -Path "C:\Hyper-V" -Generation 2 -SwitchName WiredLan
Set-VM -Name ATDGen2 -ProcessorCount 2 -DynamicMemory -MemoryStartupBytes 512MB -MemoryMinimumBytes 512MB -MemoryMaximumBytes 2048MB
New-VHD -Dynamic -SizeBytes 37GB -Path "C:\Hyper-V\ATDGen2\VirtualHardDisk\ATDGen2.vhdx"
Add-VMHardDiskDrive -VMName ATDGen2 -Path "C:\Hyper-V\ATDGen2\VirtualHardDisk\ATDGen2.vhdx"
Add-VMDvdDrive -VMName ATDGen2 -Path "D:\Software\Microsoft\Windows8.1Ent\en_windows_8_1_enterprise_x64_dvd_2791088.iso"
Set-VM -Name ATDGen2 -AutomaticStartAction StartIfRunning -AutomaticStopAction ShutDown
Start-VM -Name ATDGen2

And voila, in the few seconds VM is created. You will need approximately two minutes for OS installation on SSD. As you can see, VM is Up & Running.

3

You can expect more fundamental things related to virtualization very soon.

Enjoy the day ;)

Romeo

7 Responses to “Create New Generation 2 Virtual Machine with PowerShell – fundamentals

  1. Romeo, could you paste the PowerShell code as well?
    (image is pretty hard to read :))

  2. Pingback: Microsoft Most Valuable Professional (MVP) – Best Posts of the Week around Windows Server, Exchange, SystemCenter and more – #58 - Flo's Datacenter Report

  3. Pingback: Dell TechCenter

  4. Pingback: TechCenter - Blog

  5. Pingback: Dell’s Digest for December 12, 2013 | ServerKing

  6. MOhammad

    GOOOOOOD
    Thank you For Your Post

Leave a Reply

Your email address will not be published. Required fields are marked *