# encoding: ascii
# api: powershell
# title: The PowerShell Talk Xen2
# description: The PowerShell Talk – Demo 2, VM Easy Bake, XenServer
# version: 0.1
# author: Cody Bunch
# license: CC0
# x-poshcode-id: 1090
# x-archived: 2013-10-16T20:21:41
# x-published: 2009-05-10T15:04:00
#
#
#The PowerShell Talk
#Demo 2 - VM Easy Bake Oven
#XenServer

#Connect to XenServer
Get-Credential | connect-Xenserver -Url http://XenServer_URL/sdk

#Create the new VM
Create-XenServer:VM -NameLabel "Dave" -VCPUsAtStartup 1 -MemoryDynamicMax 536870912 -MemoryStaticMax 536870912 -MemoryDynamicMin 536870912 -MemoryStaticMin 536870912 -MemoryTarget 536870912

#Get some info on said VM
Get-XenServer:VM -name "Dave" | fl * | more

#Change the Memory
Get-XenServer:vm -name "Dave" | Set-XenServer:VM.MemoryDynamicMax -DynamicMax 268435456
Get-XenServer:vm -name "Dave" | Set-XenServer:VM.MemoryDynamicMin -DynamicMin 268435456
Get-XenServer:vm -name "Dave" | Set-XenServer:VM.MemoryStaticmin -StaticMin 268435456
Get-XenServer:vm -name "Dave" | Set-XenServer:VM.MemoryStaticMax -Value 268435456

#Delete the VM
Get-XenServer:vm -name "Dave" | Destroy-XenServer:VM
