PoshCode Archive  Artifact [06ad3cadb9]

Artifact 06ad3cadb986360d924b80075a3b8e501a3b8af0441688c03884ebd6c041dfbd:

  • File The-PowerShell-Talk-Xen2.ps1 — part of check-in [7c599787e0] at 2018-06-10 13:21:31 on branch trunk — The PowerShell Talk – Demo 2, VM Easy Bake, XenServer (user: Cody Bunch size: 1182)

# 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: 3168
# x-archived: 2012-01-21T08:34:19
# x-published: 2012-01-16T23:49: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