The greatest challenge to any thinker is stating the problem in a way that will allow a solution

Bertrand Russell

Welcome to vBlog, a personal record of my techy tinkerings and particular ponderings.

I tend to focus on VMware virtualisation, and the interaction/automation of it using PowerCLI (VMware's PowerShell Snapin), but anything that I happen to stumble across that seems like it might be of use at a later date, may well get recorded here.

I also maintain vWiki, which was a predecessor to this blog. Wiki's are great for quickly recording snippets of info, but tend not to look that great; Blog's are better looking things, but seem to require more effort so that the posts/articles are accessible in their own right. As a result I tend to update both interchangeably as available time, and depth of thought, permit.

If you happen to find anything of use, or in need of correction please leave a comment. Knowing that my ramblings are of some use is a great reward; and similarly I'd hate to waste anybody's time by feeding them duff info.

See these pages for me info about me, and my vBlog, and below for my recent posts...

Recently I had to migrate a collection of virtual machines from one vCentre to another.  They didn’t have to change datastore, so there was no need to whip VMware Converter out and cause a mass movement of data.  Just a case of unregistering from one vCentre and registering with another.  However, there were over 20 machines, in various datastores hosting some VM’s with duplicate VM names, meaning it would be quite a laborious process, and manual error prone.

So, in order to make the process nice and reliable and avoid any machines getting lost on the way, I wrote a quick script to do the hard work… Continue reading →

vApps can be wonderful things.  Essentially resource pools on steroids, I never really used resource pools that much (unless I was revising for a VCP exam), but I find the ability to control a bunch of VM’s as one entity, controlling their start-up and shut-down order very useful.  However, controlling that start-up and shut-down functionality is a pain.  The default options are (for me) wrong, and its a laborious task to go through them all and update.

As soon as I feel the potential for RSI in my mouse arm, is when I feel the need for a bit of PowerCLI script-o-magic… Continue reading →

One of the great problems with creating scripts that will be run when you’re not around is how to provide them with the credentials that they need.  Microsoft have intentionally tried to make it difficult to simply include username and password information in the raw, in scripts.  This is a good thing, but it can be an initial stumbling block when you’re getting started.

To get around this irritation, without bypassing the security it provides, I store my password in an encrypted file, which called upon by every script that needs it… Continue reading →

To my mind, the beauty of a truly powerful scripting language, is the sense that you can achieve anything that you might need to. You just need to apply yourself, and the full force of Google, and be prepared for a bit of trial and error.

The fact that PowerShell let’s you unleash the full might of the .NET army means that this is pretty much true for it. Recently I head the need to be able to interact with a number of Vyatta routers (see my SSH to Vyatta Router Using PowerShell post), in order to be able to get a load of virtual machine’s NAT’ed addresses, and found two possible solutions, one of which is fairly well documented on the Web (which I struggled to get on with), the other of which is new (in beta still at time of writing) and not particularly prevalent, but seems very flexible…. Continue reading →

Being able to send an email from a script is always a useful tool to have in your back pocket. Be it for sending out an alert for a bespoke check, an email over the weekend to let you know that that big task script has completed (un)successfully, a regular report mail, or some other reason.

Sending a basic text email is incredibly easy (2 lines), and it doesn’t take much more effort to be able to send fully formatted HTML email with attachments (though obviously you’ll need to put some effort into creating the HTML).

Continue reading →

Being able to supply appropriate security credentials are a necessary obstacle in today’s security conscious world of IT. When I first started, many moons ago, the systems I managed all had the same (dictionary word) password to the (un-renamed) local Administrator account, you didn’t lock your PC, have to change your password, or have to worry about not being a domain admin on every system by default.

PowerShell scripts inherit the rights of the user that start them, which is normally all well and good if the script only need to run and access local resources, but as it needs to access any remote resources the chances of having to supply credentials grows rapidly.

Credentials are represented by a PSCredentials object , this can then be supplied to a CmdLet that requires it… Continue reading →

The ability to snapshot a VM is wondrous thing; the ability for a snapshot to be forgotten, eat up all all your storage or grow so large that you can’t remove it without causing impact is not so wondrous.

How you manage snapshots is up to, but unless you routinely tidy them up (especially if you use some thing that utilises snapshots like vRanger, which can occasionally leave them behind), they will cause you a problem at some point.  And sod’s law dictates that the problem occurs to important VM, when you haven’t the time to spare. Continue reading →

A while back I came across an intermittent storage problem, whereby paths were occasionally going down and coming back up for a period of time.  In order to be able to tally the timings of the events up with other goings on (eg when looking at SAN logs etc) I needed to create a an export of when the events were occurring.

Note that Get-VIEvent is limited to 1000 results, which will typically get 1 – 2 days worth depending on your infrastructure. To get a longer history would require multiple calls to Get-VIEvent using the -Start and -Finish parameters Continue reading →

Its bizarrely difficult to be able to map VMware presented datastore names to the underlying LUN’s in the PowerCLI, despite the fact that its readily available via the VI Client.  It’s even more difficult if you have to worry about both VI3 and VI4 vSphere installations as they handle storage in differing ways, hence the two different approaches below. The ESX3 method attacks the problem by starting its search at an ESX, whereas for ESX4 we start the attack at the cluster…

Continue reading →