Hyper-V PowerShell Script Cookbook
Hyper-V in Windows Server® 2012 introduces the Hyper-V module for Windows PowerShell, which includes more than 160 Hyper-V cmdlets. These cmdlets provide an easy way to automate Hyper-V management tasks.
For an alphabetical list of all Hyper-V cmdlets in Windows Server 2012, as well as links to reference content for each cmdlet (including examples), see Hyper-V Cmdlets in Windows PowerShell.
Below you will find a list of sample Hyper-V related PowerShell scripts to accomplish various tasks.
You can search for additional Hyper-V scripts in the TechNet Script Center.
Important: These are sample scripts that you can use to learn how to create your own Hyper-V specific PowerShell scripts. It is your responsibility to test each and every script in a lab before running in your production environment.
Windows PowerShell resources:
If you have a favorite script, please go ahead and add it to the list.
Virtual Machine:
- PowerShell snippet: “start a virtual machine and wait for a bit"
- PowerShell Script for Exporting a virtual machine
Virtual Hard Disk:
Network Virtualization:
- Simple Hyper-V Network Virtualization Demo
- Simple Hyper-V Network Virtualization Script with Gateway