Wednesday, July 7, 2010

How to install and use PowerShell Management library for Hyper-V R2

Read the following posts:
http://trycatch.be/blogs/roggenk/archive/2010/02/08/powershell-management-library-for-hyper-v-r2.aspx
http://trycatch.be/blogs/roggenk/archive/2010/05/26/managing-windows-server-2008-r2-using-powershell.aspx
Examples:
# get default VHD path for server ariadne
Get-VHDDefaultPath -server ariadne
# get VM state for all VMs in server ariadne with a formated output
get-VMState -server ariadne | ft -property VMElementName,GuestOS,EnabledState,Name -auto
# Start a VM Session
New-VMConnectSession -vm strgsrv -server ariadne
# Start a VM
Start-VM -vm strgsrv -server ariadne
# Shutdown a VM
Invoke-VMShutdown -vm strgsrv -server ariadne -Force
# Shutdown all VMs in server ariadne
Invoke-VMShutdown (Select-VM -Server ariadne -Multiple) -Force
# Shutdown all VMs in server ariadne
Get-VM -Server ariadne -Running | Invoke-VMShutdown -Force
# List all stopped VMs in server ariadne
get-VM -Server ariadne -Stopped
# Start all VMs in server ariadne
get-VM -Server ariadne -Stopped | Start-VM
# Get a build script for VM strgsrv of server ariadne
Get-VMBuildScript -vm strgsrv -server ariadne

No comments:

Post a Comment