XenApp Cmdlets From Synergy

2009-05-10_2000

Brandon Shell published his Synergy demo, exhibiting the power of PowerShell when used with XenApp. You can also take a look and Brian Madden & Brandon talking PowerShell here.

Demo 4 – Mass Provisioning: csv-provision.ps1

Here is the sample code from our fourth and final demo during the presentation, the “Mass Provisioning”:

In order for this script to work, you need to supply it with a csv file that has a format similar to:

ServerName,CPU,RAM,DISK,OS
Test1,1,1024,20480,rhel5guest
Test2,1,1024,20480,winNetEnterprise64Guest

In fact, the above can be copied and pasted into a .csv file, and supplied as a parameter to the script. Here is what it looks like when run from the command line:

2009-05-10_1954

Also of note. The values for “OS” can be had by using “get-help new-vm –detailed”.

Questions? Drop a line in the comments.

Count Those Chickens – Demo 3 count-chickens.ps1

This was covered in the ‘advanced topics’ section of our presentation. It is of course, the chicken counter script:

This script introduces a few new and advanced concepts (at least in the context of the presentation). The first having to do with VI Credential Stores (More Info). The second being custom properties (The Name, Expression blocks). and finally e-mail.

By changing the appropriate lines in the script, and providing an suitable VI Credential Store, you should be able to plug this right into your environment.

Questions? Hit us up in the comments.

Demo 2 – XenServer

This is the “VM Easy Bake Oven” rewritten for XenServer. Take a look at the example code:

Same flow as the VMware Demo. Connect, create, get some info, change the VM, and delete the VM. Special things to note here however, is that the Memory (DynamicMax, StaticMin, etc) need to be set in bytes. Other than that, it should be straight forward.

Questions? We’d love to have em. Drop a line in the comments.

Demo 1 – XenServer

This one flows much the same as Demo 1 for VMware. The example code:

Here we get credentials, and pass that to the connection to XenServer. Note that for XenServer (at least the Citrix variety) you need to specify the URL of the Xen HOST itself. After that we create the network, change it’s description, and finally destroy it.

If you have any questions hit us up in the comments.

Demo 2 – VMware

Here is the code from the “VM Easy Bake Oven” or Demo 2 for VMware.

This one flows much the same as Demo 1, connect, create a VM, change the VM, and delete the VM. These commands are useful from the command line to create single or multiple VMs, as well as for getting used to the commands and their structure overall. They become mighty powerful when you want to incorporate something like a CSV and templates (Another of our Demos)

Demo 1 – VMware

Here is the code used in Demo 1 during the presentation:

If you weren’t there… First, shame on you (though they moved our session date/time so…). Second, here is a bit of what the code is doing (other than making spelling mistakes):

First we connect to the vCenter (or ESX Host directly). Then we go about creating a virtual switch and port group (you need both in order to hook VMs to it). We then change the VLAN, and number of ports. Finally, we make it go away!

If you’ve any questions leave them in the comments.

Enable VI & Xen Snapins in PowerGUI

In order to get the syntax highlighting and other ‘really cool’ features (tab-complete, etc) in PowerGUI Script editor, one needs to enable the PowerShell Snapins for Xen and VMware.

“File > PowerShell Libraries…“
2009-05-10_1634 

Then click each Snap-in to enable, and hit OK!

2009-05-10_1634_001 

This technique can be used for each additional snap-in as well (Hyper-V, AD, DNS, Exchange, NetScaler, etc).

Editor of Choice: PowerGUI – Resources

This was brought up during the Q & A portion of the presentation: “What editor are you using in the examples?”

The answer: Quest’s PowerGUI.

Take a look, see if this is familiar:

2009-05-10_1626

  Recent Entries »