Archive for the ‘Virtualization’ Category

Custom shares on a Resource Pool, scripted (Modified)

Well I’ve been taking a bit of a break from XML-based powershell code, ‘coz it was doing my head in working with that. I was going through some older blog posts on YellowBricks and stumbled across a few related to Resource Pools, specifically related to how shares work.

Now I was always under the impression that shares were already weighted to account for the number and size of VM’s in them… however I was clearly mistaken. I did actually raise this question during my vSphere training and was assured that was the case…. so it’s definitely something to be aware of. The Resource Pool Priority Pie Paradox Read the rest of this entry »

Clone-to-test: Part 2

In this post I present the first script. It took me quite a while, as I had to figure out how to do everything. I’m no rocket-scientist, so if I can figure it out, you all have hope too. I really do suggest getting your hands dirty in some code, powershell is pretty easy to pick up. :)

If you haven’t done so already, I would suggest reading Part 1. You may also want to check out the architecture of my isolated test environment, as the design is pretty closely linked with my particular requirements.
Read the rest of this entry »

Clone-to-test: Part 1

Well it’s taken me a while, but I’ve just completed the first part of my test environment migration process. So I thought I’d post up the design and architecture diagrams.

The idea is to provide a repeatable process for cloning batches of VM’s from the production network into my organization’s isolated vm-test environment. The cited use cases for this environment include Virtualization infrastructure change testing, VI development, VI product evaluation and Virtual Machine change test/verification. This series of scripts addresses the last requirement in an automated manner. Read the rest of this entry »

VMware Basic VM Performance as XML (Powershell)

Well continuing my recent foray into scripting, I wrote a small script to dump some basic stats about each VM into formatted XML.

The purpose is to get a basic idea of average use accross all our VM’s. We’re using this information as part of a virtual infrastructure review and redeployment. We have budget to replace aging ESX hardware and we’re taking the opportunity to tidy things up a bit.

The script is using the same framework as my dump-virtual-machine-info-as-xml script posted previously. I’ve grown quite fond of XML, although I’m sure I can definitely improve it…. for a start creating a proper schema.
Read the rest of this entry »

My VMware Test Environment

So I thought I’d share with you some background on the test environment I’m building, as I’ll be posting the scripts I’m developing to make it all happen… so a bit of context will hopefully help you.

My organization is currently going through a phase of massive expansion and as a result we’ve been given a little freedom to explore new technology and increase our knowledge and experience with VMware. To experiment with the new products and also to test changes to VM’s, we decided to build a small 2-node VMware cluster mimicking prod as closely as possible. Read the rest of this entry »

vHW Upgrade Risk Calculator v0.5

One of the tasks on my plate is to upgrade the virtual hardware of approximately 300ish VM’s. We need this done to support backup using the VDAP mechanism through Commvault.

My environment is politically pretty complex, and we have no agreed maintenance window; This creates an interesting situation for upgrades of this scale. So I thought I’d knock up a bit of a risk calculator to try and identify which VM’s are likely to experience trouble during the vHW upgrade.

This is the first part of the project and will help us do the first stage of grouping and outage scheduling.

The next part, which I’m developing now, is a script to clone a batch of VM’s to an isolated VM test environment (a pair of ESX servers, on a duplicate, but isolated LAN segment).

Once we have a running clone of each batch, I can use Update Manager to do the tools and vHW upgrade, then run a testing script over them. This process will allow us to catch out the problematic VM’s ahead of time and schedule their upgrade in a more closely monitored way.

So without further a due, Here it is: VI_vHW_Upg_cheatsheet.

Hopefully this is of use to someone :)
-Doug

Dump Virtual Machine Info as XML (powershell)

Hi All,

I was recently asked to provide a comprehensive list of VM’s and their currently provisioned hardware. We have a need to duplicate this view in the future, so I decided to script it. My org also does charge-forward, so this dump of information is useful.

I used the script by Arne Fokkema “PowerCLI: Virtual Machine Disk (VMDK) info v2: Analyze data with Excel” as a base.

I initially tried to use the built-in XML export option, however the formatting wasn’t very nice, so I decided to build a custom schema and populate that instead. Using this approach allowed me to include all the detail I wanted, nested appropriately… for easy collation and searching later in excel.

So running through the script, this is how it works.

Firstly, like a good programmer, define the global variables.

#--- Parameters ----------------------------------------------------------------------------------------------
#XML Template
$XMLTemplateFile = "C:/tmp/VMachines_Template2.xml"
#Output XML File
$XMLOutput = "c:/tmp/VMachines.xml"
#Use Shortname?
$UseShortname = "True"
#Get Application details?
$GetAppdocInfo = "False"

Ignore the AppdocInfo flag…. that’s for another day 😉

Now, since we’re creating a custom XML output we need to define the template.

#Define the XML Template
$XMLTemplate = @'
... etc
'@
$XMLTemplate | Out-File $XMLTemplateFile -encoding UTF8

$XMLVMachines = New-Object XML
$XMLVMachines.load($XMLTemplateFile)
$XMLVMachine = @($XMLVMachines.VMachines.VMachine)[0]

The template is defined inline, written out to a temporary template file, then read back in as an array of XML objects (with only one object so far, the template). Once that’s done, we can populate the array by cloning the template and adding data.

Now we have a custom XML object to work with, we can begin collecting the required data. Read the rest of this entry »

The opinions expressed on this site are my own and not necessarily those of my employer.

All code, documentation etc is my own work and is licensed under Creative Commons and you are free to use it, at your own risk.

I assume no liability for code posted here, use it at your own risk and always sanity-check it in your environment.