PoshCode Archive  Artifact Content

Artifact 8924fd0beb8644cdfd041cb4e949358a512ac6f04347199d0b40039a96ff281f:

  • File The-PowerShell-Talk-Xen2.ps1 — part of check-in [53dcd44e85] at 2018-06-10 12:56:24 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: 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