I recently had to gather the VLAN ID information from a vCenter environment where some hosts had standard and distributed switching in use for their virtual machine networking. Unfortunately, the data for VLAN ID is located in different fields depending on the vSwitch type. So, here’s a simple script to gather both sets of into a CSV. Read the rest of this entry »

Recently had an issue with a poorly coded in house application that was dumping out small report files for every user request and had no cleanup or folder structure for these reports. The end result being some 1.6 million small files in a single directory, all with the same naming structure “FTGReport_. Now, add to this that it is running on Windows 2003 server and you have a problem. As 2003 was still generating short names for files, if you have more than 300,000 files with the same first 6 characters, you hit this odd issue, where file system performance dies a horrible death, as the kernel is looping trying to find a unique shortname to use.

To get around this, I had to attach the VMDK to a Windows 2008 box and use the script below to reorganise all the files into a date stamp based folder hirachy. Because despite the application not actually using any of these files, they needed to still be accessible for historical and audit purposes in some fashion! Read the rest of this entry »

DRS is a great feature, but more and more, I’m finding clients who just need a very simple cluster setup, but only want to pay for vSphere Standard licenses. Well, the script below can be used to run a job that will randomize the list of VMs in a cluster and then balance them across all hosts in the cluster. This is purely a VMs/host type of balance, not a resource balance like DRS. But, I set this up to run once a week on a few client’s DEV clusters and it generally keeps things pretty even. Also very useful for post maintenance re-shuffles. Read the rest of this entry »

There have been a few posts around generating the direct console URLs for VMs and they all seem to use Perl. Based on the info from these posts, I have created this cut back PowerCLI version. Only tested with vCenter 5.0 and outputs to a CSV file for every VM in the environment. Read the rest of this entry »

While I like having VMs update their tools on reboot, it can cause some issues with running SRM testing and planned migrations, causing timeouts while waiting for vmtools. Rather than increase the timeout or go through the hassle of raising a change to updated the tools across an environment, I used the following script block to disable auto update for all the VMs and re-enable it once it came across to the other side. All credit goes to Damian Karlson for this one. Just reposting so I have my own copy. Read the rest of this entry »

Balance a Group of VMs Across Hosts

Posted: November 27, 2012 in Scripts, VMware

I had a scenario recently where a whole bunch of VDI machines were being created in the main production cluster, but there were 2 ESXi hosts outside the cluster that were going to be dedicated for VDI. I put together this little script for the VDI admins, so that they could just drop the list of all their VM names into a text file, run the script and the VMs would be be balanced across the dedicated VDI hosts. Read the rest of this entry »

Cleanup After a Windows Service Pack

Posted: September 18, 2012 in Windows

Just for my own referrence really. This will reduce the size of the C:\Windows\winsxs folder after a service pack install (on Server 2008 that I know of). Read the rest of this entry »