A while ago James a colleague of mine posted his PowerShell scripts onto the codeplex site. With those scripts you can easily manage your Hyper-V environment by using PowerShell. For me this a must have library. Here is a list of what you can do with this library:

Finding a VM
Get-VM, Choose-VM

Connecting to a VM

New-VMConnectSession

Discovering and manipulating Machine states

List-VMState , Set-VMState , Convert-VmState,
Ping-VM , Shutdown-VM , Start-VM, Stop-VM, Suspend-VM
Get-VMKVP

Backing up, exporting and snapshotting VMs

Backup-vm , Export-VM , Get-VMSnapshot, Choose-VMSnapshot , Apply-VMSnapshot , New-VMSnapshot ,Remove-VMSnapshot, Get-VMSnapshotTree

Adding and removing VMs, configuring motherboard settings.

New-VM , Remove-VM , Set-VM , Get-VMCPUCount, Set-VMCPUCount, Get-VMMemory, Set-VMMemory

Manipulating Disk controllers, drives and disk images

Get-VMDiskController
Add-VMSCSIController , Remove-VMSCSIcontroller
Get-VMDrive , Add-VMDRIVE , Remove-VMdrive
Get-VMDisk, Add-VMDISK , Set-VMDisk, List-VMDisk
Get-VMFloppyDisk , Add-VMFloppyDisk
Add-VMNewHardDisk

Manipluating Network Interface Cards

Get-VMNic , List-VMNic , Choose-VMNIC, Add-VMNIC, Remove-VMNIC , Set-VMNICAddress , Set-VMNICConnection , Get-VMNicport ,
Get-VMnicSwitch, Choose-VMSwitch, New-VMSwitchPort, Get-VMByMACaddress

Working with VHD files

Get-VHDDefaultPath, Get-VHDInfo, New-VHD, Compact-VHD, Mount-VHD, Unmount-VHD

Download the PSHyperv library.

Technorati Tags: ,