Thinking About Upgrading To vSphere 5.1?

If you haven’t made the jump to vSphere 5.1, then you may want to try this new fling out (vCenter 5.1 Pre-Install Check Script) from Alan Renouf before upgrading.

(*description borrowed from the Fling’s website)
This fling is a PowerShell script that when run will help customers validate their environment and assess if it is ready for a 5.1.x upgrade. The script checks against known misconfigurations and issues raised with VMware Support. This script checks the Windows Server and Active Directory configuration and provides an on screen report of known issues or configuration issues, the script also provides a text report which can help with further trouble shooting.

For more information, read New Fling: vCenter 5.1 Pre-Install Check Script.

As a reminder, all checks are read-only and no changes are made to the system.

I use many of Alan’s scripts during my customer engagements and this is one more that I have thrown into my bag for future health checks and upgrade validations.

Script: Changing the Path Selection Policy

Last week I had performed a semi-automatic (scripted) turn key installation. Before going out to the customer site, I had set the install script to set the SATP and the PSP for an Equallogic Array (SATP = VMW_SATP_EQL, PSP = DELL_PSP_EQL_ROUTED) during the installation. Unfortunately, I found out after the fact, that they had a Compellent Array. Because of this, I needed to change the SATP and the PSP (SATP = VMW_SATP_DEFAULT_AA, PSP = VMW_PSP_RR) for each of the existing LUNs and any future LUNs.
Continue reading “Script: Changing the Path Selection Policy”

Script: Merge Multiple Arrays

Each Saturday my company does a refresh of a few different machines. This refresh consists of cloning a couple of production machines into our lab environment for development. It’s a very tedious process that takes the entire day to do. Until recently, this process has been done manually. I’ve been working on a script to automate the process as much as possible. Along the way, I’ve learned a great deal about powershell/powercli – especially from hitting a wall and trying to figure out a way around. This blog entry is about one of those snags along the path of progress.

The refresh consists of two major Acts. Act I is all about cloning the source VMs, stripping them down, and converting them into templates. Act II is about deploying VMs using differing templates. There will be a later entry discussing this entire script in greater detail. This entry focuses on creating merged array to be used in the deployment CSV list for Act II.

Each week, the refresh list changes. One week, the source VMs may be SourceVM01 & SourceVM05. Next week, it may be SourceVM01 & SourceVM03. I created a GUI frontend for this script using PrimalForms 2011. The GUI has a “pick-list” where you can cherry pick what SourceVMs and what DestinationVMs will be needed. Upon your selection, three arrays are built – $a = #VM Names, $b = #Specs, $c = #Template Names.

For example;
If I needed to refresh DEV-VM01, TEST-VM01, and QA-VM01; I’d check their boxes, and the following variables would be added to the three arrays. (You can start to see where if you had multiple Dev and Test VMs how these arrays can get quite complex.)

$avm = “DEV-VM1” $avm = “TST-VM1” $avm = “QA-VM1”
$bspec = “DEV” $bspec = “TST” $bspec = “QA”
$ctmp = “TMPL-DEV01” $ctmp = “TMPL-TST01” $ctmp = “TMPL-QA01”

So the question was, how do you take this information and merge it – with one array, and all the information within? That’s where I came up with this solution.
I replay each of the arrays using a “counter” ($i) and building a new array with the information from the table above. The counter variable matches each record for that row (ie. $a.record1 with $b.record1 and $c.record1).

The array will continue to loop, until it runs out of entries based on the $a array. Once this fourth array ($d) has been created, I can then use it to build my deployment CSV file (SEE THE DEPLOYMENT CSV LIST BUILD SCRIPT – To come).

Script: Detailed NIC Information Report

Over the last few days, my coworker and I have been working on a script that will go out and collect detailed network information for each NIC on our ESX hosts. Not wanting to reinvent the wheel, I strolled over to Alan Reneuf’s website ( I had remembered seeing a script (“More Network Info”) he created that I knew could collect the info we wanted. Thank you, Alan.

I copied Alan’s script into Notepad++ and started to work with it. One of the things we needed to know was duplex information. Since that wasn’t in the original script, I added it. I didn’t need to know the number of active virtual switch ports, so I removed that portion.

Here are the end results of this modified script.


The above script may not actually display properly within this blog entry. If this is the case, you can download the script here.

Script: Drive Letter Order

I’m currently writing an application (it’s a huge script – 2100 lines of code) in powershell to automate a weekly VM refresh operation that my team does every Saturday. At the end of the script, I wanted to check the newly deployed virtual machines to verify that the automated scripts did what they were supposed to. One of the items on this checklist is to check the drive letters. For the business owners, the VM has to be setup similar to the source machine. The drive letters have to be setup as follows: C Drive (OS), D Drive (CD Rom), E Drive (Data).

"Click for larger image."

I use VMware’s clone ability to copy the source VM into a template. I use a “CustomizationSpec” to reset the VM’s identifiers and “sysprep” the virtual machine. During the “sysprep” process, the drive letters are reset to: C Drive (OS), D Drive (Data), E Drive (CD Rom). Since this doesn’t meet the customer’s requirement, I created a batch script that is called during the runonce section to change the drive letters. This batch script was placed on the source machine with its’s support files, and is thus carried forward in the clone.

Continue reading “Script: Drive Letter Order”