New Hyper-V cmdlets in PowerShell 4.0

 May 22, 2015

Whilst there have some great new features, updates and bug fixes in PowerShell 4.0, I think the new Hyper-V cmdlets added in PS 4.0 have been largely overlooked. However, I think they are worthy of extra attention, and give us poor Hyper-V administrators some very useful features and automation capabilities in managing our Virtual Machines.

There are 13 brand new cmdlets directly related to Hyper-V in PowerShell 4.0 and they are listed and described below. I have also hyperlinked each command to their full descriptions in Microsoft’s TechNet website, so you can reference their complete syntax and detailed description.


As the name implies, the Copy-VMFile allows you to copy files into your Virtual Machines. It does require Hyper-V 3.0 (on Server 2012 R2 and Windows 8.1), the Integrated Services Version must be at least 6.3.9600.16384 (i.e. Server 2012 R2 or Windows 8.1) and Guest Services must be enabled. The CodePlex website guys have even written a neat little GUI as a front end for the Copy-VMFile command – it can be found here.

Get-VMFirmware / Set-VMFirmware

Server 2012 R2 and Windows 8.1 brought in Generation 2 Virtual Machines, and with the new Get/Set-VMFirmware commands we can now retrieve or set the firmware boot order and other firmware configuration settings for our Gen 2 VM’s (Get/Set-VMBIOS is used for the Gen 1 VM’s).

New Hyper-V cmdlets in PowerShell 4.0

This new PowerShell v4.0 command enables you to get a kernel dump of a VM in Server 2012 R2. It does this by injecting a non-maskable interrupt into the VM. The basic syntax is:

Debug-VM –Name “VM_Name” –InjectNonMaskableInterrupt -Force


These three commands reference the Extended Port Access Control Lists (ACLs) that is new in Windows Server 2012 R2. The Extended Port ACLs let you create firewall rules that apply to the individual virtual NICs within a VM, and you can only create and manage these rules through PowerShell. They allow you to filter inbound and outbound traffic or both, The main update to ACLs here is that you can not only create ACLs based upon MAC and IP addresses as in Windows Server 2012, but R2 now adds the ability to use socket port numbers as well. These extended ACLs give you many more options in your firewall rules and are especially useful in multi-tenant environments.

New Hyper-V cmdlets in PowerShell 4.0

These two commands can retrieve or set network isolation settings on your VM’s Network adapter. You can isolate the adapter by either Virtual Local Area Network (VLAN), Hyper-V Network Virtualisation or third part network virtualisation settings. Again these commands are geared towards multi-tenant settings.

New Hyper-V cmdlets in PowerShell 4.0

Another set of commands geared towards multi-tenanted environments. These commands allows you to add, view, configure and remove specified routing domains and virtual subnets for tenants to the virtual network adapters associated with your multi-tenant virtual machines.

So there you have them, a quick intro to a number of new PowerShell/Hyper-V commands with some great new configurations geared for multi-tenant environments. But these can actually be of use to us even if we don’t have a multi-tenant environment – this new network virtualisation architecture Microsoft has given us in Windows Server 2012 R2 helps us to live-migrate VM’s to Hyper-V hosts that reside in remote subnets, such as a remote datacenter, without having to make changes to the VM’s IP Address, and allows us to set firewall rules that apply to individual NICs within a VM etc. etc.

Of course, my favourites are the Copy-VMFile command that lets me copy files into my new VM’s, and the Set-VMFirmware command that allows me to change the boot order of my VM. So what are your favourites, and what scenarios can you see them used in?

How do your Excel skills stack up?   

Test Now  

About the Author:

Gordon Cowser  

With over 22 years real world and training experience, Gordon is our most senior IT Infrastructure trainer. His expertise includes but is not limited to; Microsoft Server and Client OS, Messaging, Collaboration, Active Directory and Network Infrastructure. Gordon also specialises in SharePoint technologies training in both technical and end user aspects. With his extensive skill-set he brings a thorough mentoring capability to the classroom where he can advise on technical issues and challenges often beyond the scope of the course curriculum. A very approachable and experienced training professional, he has the ability to establish credibility fast with students at all levels.

Read full bio
Back to top