Archive for 'Scripts'

Four PowerCLI One-Liners That Saved The World!

Ok, So maybe they didn’t save the world, but the sure saved my weekend. Rather than spend a lot of time on the intro, let’s dive right in. These will be in Problem/PowerShell/Output format.
The Problem:
More spaghetti environments, this time we need to count some resources. The first counts CPU, the second Memory. Yes there are [...]

Today’s Bit of PowerShell Awesome – Primal Forms

I often find myself with more tools to check out than I have time to do the checking out. One of the tools that has been on my laundry list for a while was Primal Forms from Sapien. In a single word, this tool is “Awesome”.
From the site:
PrimalForms is a free GUI builder tool for [...]

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 [...]

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 [...]

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 [...]

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, [...]

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 [...]

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 [...]