Hyper-v 3 commands in powershell

Hyper-v 3 brings alot new functionality on the field in their fight against vmware.
Will this be enough to take on the battle with vmware? In case if you have SCVMM 2012 and Hyper-v3 the gaps are getting closer. .

Some of the main features for Hyper-v 3:

  • No processor/core limit on the Hyper-V host
  • 160 Logical processors
  • 2TB memory on the host
  • 1TB memory per VM
  • 1024 VM’s per Hyper-V host
  • 32 virtual processors per VM
  • Failover Cluster Support
  • Live Migration
  • Live Storage Migration
  • Shared Nothing Live Migration (without requiring shared storage)
  • RemoteFX with more monitors and resolutions
  • Storage Spaces
  • VMs on File Based Storage (SMB 2.2 Share on a Scale Out File Server)
  • Vendor independent NIC Teaming (This ive explained in earlier post)
  • Hyper-v replica

In a later post ill discuss the connection between scvmm 2012 and hyper-v but for this post ill focus directly on Hyper-v and quick commands you should learn in order to do basic stuff in Hyper-v

First of you can see all the commands, related to Hyper-v by typing the command.
Get-Command -Module Hyper-V

In case there have been some updates from Microsoft you can use the Update-help command to update the help library in Powershell.

Lets do some basic commands:
1: Create a new virtual machine.

New-VM –Name “new 2” –MemoryStartupBytes 1GB –NewVHDPath d:\vhd\base.vhdx

This will create a new virtual machine named new 2 with 1 GB of memory and the VHDX is stored on the drive D:

Of course you have alot of other parameters here that you can change, you can use the get-help new-vm you see all the parameters.
In case you have some old virtual machines you want to import in the new Hyper-v you can use the Import-vm command

Import-VM –Path ‘D:\Test\VirtualMachines\5AE40946-3A98-428E-8C83-081A3C6BD18C.XML’

Here you just specify XML configuration file of the old virtual machine, and ill will get created with the settings it had.

Of course you can also start and stop the VM using the «Start-vm or Stop-vm»
Something that might be useful to remember, is to change the vlan of the network on the virtual machine.

Set-VMNetworkAdapterVlan –VMName test –Access –VlanId 121

This will change the VlanID on the virtual machine named test to vlan 121 (This is using standard 802.1q trunking protocol) Which all network equiptments support today. Its also the same one that vmware uses.

Just have to shoot in some Cisco commands here as well🙂
If you want to change the vlan on a interface that the vm is connected to.

Incase you have the vm connected to a cisco switch you can use this command, to change then vlan ID on the switch interface.

enable
conf t
interface FastEthernet0/1
switchport access vlan 121 

Incase you want to look a bit closer on the Powershell cmdlets for Hyper-v I suggest you check out this Microsoft page on Hyper-v http://technet.microsoft.com/en-us/library/hh848559.aspx

Now this is the end of post 1, more will follow I will try to include SCVMM2012

#storage-spaces, #vhd, #virtual-processors