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.)

DEV-VM1 TST-VM1 QA-VM1
$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 (www.virtu-al.net). 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.

NETWORKINFO.PS1

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

Error: Cannot create a quiesced snapshot

I came across an issue this weekend that I wanted to share. I’ve written a script that automates the process my company uses to conduct a refresh of a production machine. Recently, we’ve upgraded our vCenter from 4.0 to 4.1. In addition, PowerCLI was upgraded to 4.1.1. Of course, some things are off on my script now (I’m currently in the process of fixing all the new bugs the upgrade introduced).

Until I get all the kinks worked for the script to run properly again, I decided to run the script locally from my machine. The problem with this is that my workstation is not on the domain. This causes a few portions of the script that needs domain access to fail. One of these sections involves moving the source VM to a different OU so that the security banner is removed at login. I expected this portion to fail, however, I did not expect it to generate an error within the VC and domino out of control.

The error that I got was “Error: Cannot create a quiesced snapshot.” I quickly stopped the script and referenced Professor Google on the issue, and found the following link on the matter.

http://www.cenobite.eu/index.php?option=com_content&view=article&id=32:cannot-create-a-quiesced-snapshot&catid=8:esx&Itemid=33

I quickly read through the post and verified my VM, the settings, and the script. Then I noticed something.
This is the section of my script that caused the error.

The problem that occurred here was that the VM was power-cycled, but the desktop stilled showed that it was “Applying New Settings”. So enough time had not transpired to provide the VM, the opportunity to complete the boot cycle. Right after this the script removes the destination VM, and then starts the clone process. Since the desktop had not completed the boot cycle, I got the error. When the clone process attempted to take the snapshot so that it could start cloning, the VM was not in a ready state.

To resolve this, I wound up having to revert back to the manual process. During that process, if I waited for the VM to complete its’ boot cycle, then all was well. For me to correct my script, I will be implementing the following logic check to verify the status and see if it the powercycle was successful.

This should loop until the VM is registered as “PoweredOn” and the VMTools are registered as “OK”. This will require VMTools being current, else the loop will never end because VMTools will not read “Ok”.