Search Wiki:
PowerShell management Library for Hyper-V
A project to provide a PowerShell management library for Hyper-V

It does pretty much what it says. Note that a lot of the information available from Hyper-V is only available if Powershell is running with Elevated privilege
At present there are 66 functions in the library, some of these are worker functions which are not expected to be called directly, the others are listed below

Finding a VM
Get-VM, Choose-VM , Get-VMHost

Connecting to a VM
New-VMConnectSession

Discovering and manipulating Machine states
Get-VMState , Set-VMState , Convert-VmState,
Ping-VM , Shutdown-VM , Start-VM, Stop-VM, Suspend-VM
Get-VMKVP, Get-VMJPEG

Backing up, exporting and snapshotting VMs
Export-VM , Get-VMSnapshot, Choose-VMSnapshot , Apply-VMSnapshot , New-VMSnapshot ,Remove-VMSnapshot, Get-VMSnapshotTree, Get-VmBackupScript

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-VMDriveByController , Add-VMDRIVE , Remove-VMdrive
Get-VMDiskByDrive, Add-VMDISK , Set-VMDisk, Get-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, Choose-VMExternalEthernet,
New-VMExternalSwitch, New-VMInternalSwitch,New-VmPrivateSwitch

Working with VHD files
Get-VHDDefaultPath, Get-VHDInfo, New-VHD, Compact-VHD, Test-VHD,Convert-VHD,Merge-VHD,Mount-VHD, Unmount-VHD
Last edited Aug 18 at 11:12 PM  by jamesone, version 8
Comments
BenoitD wrote  Jun 24 at 7:29 AM  
Just what the doctor prescribed for a lazy system administrator like me! Thanks very much. However, how about making all functions, filters and variables global, so the file can be used as a profile script? I've done it and it works a treat...

/Ben

hil wrote  Jul 31 at 4:57 PM  
Is there a place for us to add examples? I have some good examples here:
# use dot source to import the functions
. D:\scripts\hyperv.ps1
# Shutdown a virtual machine that has name Base1
get-vm | ? { $_.ElementName -eq "Base1" } | Shutdown-VM

Updating...