vmtools update on power cycle

So recently I had to powerdown a vast majority of my guests due to an outage.
I thought it a good time to upgrade the vmtools. But bugger me if I was going to edit the settings on every single vm, so I searched for a better way.

Work through vcenter and configure every vm that meets the OS Windows Guest to upgrade vmtools on powercycle

Once again you may need to sign these scripts in order to run them.

I strongly suggest doing the Add-Signature.ps1

Foreach ($v in (get-vm)) {
$vm = $v | Get-View | Where-Object {$_.Guest.GuestFamily -eq 'windowsGuest'}
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.ToolsUpgradePolicy = "upgradeAtPowerCycle"

Once complete and a powercycle has been done you can set back to manual with this.

Foreach ($v in (get-vm)) {
$vm = $v | Get-View | Where-Object {$_.Guest.GuestFamily -eq 'windowsGuest'}
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"

Stolen from..

So now we can use the knowledge in this code to do some really simple cool things….

Start every vm that meets the OS family Windows Guest

Foreach ($v in (get-vm)) {
$vm = $v | Get-View | Where-Object {$_.Guest.GuestFamily -eq 'windowsGuest'}
Start-VM -VM $vm</code>

About me (whackdiddy)

The Beginning

Way back, around 1982 I was introduced to computers through the faithful Commodore 64.

My brother and I woke up early on Christmas day to find it sitting under the tree.

I can still smell it to this day, we quickly unwrapped it and plugged it into the old TV. We managed to get it to the first prompt before mum and dad came out and told us to get to bed as it was only 3am. So we reluctantly went back to bed all the while dreaming about the fun we would have with the TAC-2 joysticks and the games.

Over the next couple of years my brother and I had pulled the commodore 64 apart to see what makes it tic. We had also worn out the TAC-2 joysticks after repairing them countless times by lifting the metal hinges. We even tried some coding, I think it was meant to be a soccer goalie game. From memory it took us over two weeks of solid effort to get all the code in just to find that a mistake had been made in the printing and the game did not actually work.

Lessons Learnt,

Computers are fun..

The Middle

I found myself working with the military, setting up satellite connections and fast deploy-able networks. For those that remember the 5-4-3-2-1 rule, in this environment we were self sufficient. We carried with us servers in the way of laptops, hubs, routers and good ole Cat5. We would crimp our own cables in the middle of the night under a plastic sheet due to no light restrictions (An order from command that you are to show now naked light, otherwise you will give away your position and the enemy will shoot you). It was tough, we would get setup and then good ole Tex would be sitting at our trailer boiling water for coffee’s all round. I would normally bum a smoke and then punch out some Zzzzs after a 18 – 20 hour straight day. Then we would get notice to move and we would repeat the process over and over.

Lessons learnt

Computers in the right scenarios can be very productive.

We managed to create a paperless office way back in 1997.

Computers in the wrong scenarios can be a huge distraction and expensive.

Due to a lack of training, some of our users simply could not use the equipment.

Although we did go through a major transition, at one stage you would put a laptop on the desk of a user and he would simply push it away. They would opt to use the trusted pencil and paper. However within about six months I thought I would be smart and created an unscheduled outage to see what would happen. These same users that initially pushed the laptop away became lost, they picked up a book or newspaper and simply stopped work. The pencil and paper was now old school even to those from the old school.

The Now

We have entered a new era, where virtualisation is king.

Who would have thought way back when that you could host a server within a server, and if you are really up for a challenge a server within a server within a server.

For giggles I created a Xen farm, installed a vSphere host and then a windows 2008 r2 on the vSphere host running vcenter to manage the host.

So we all became comfortable with the idea of virtualisation. It was impressive, like really impressive. We can now buy two physical servers (HA), IBM 3850 X5 for example, and potentially run 50+ servers on them. Now just think about that for a minute, you have just reduced your physical server count from 50 to 2.

50 x 4RU = 200RU = 5 Racks of 42RU each, not including the switches and cabling

2 x 4RU = 8RU = 1 Rack + room for storage + room for a switch + room for a UPS.

But lets not stop there, just think the savings.

Power savings, you are no longer running 50 servers your are running 2.

Just think of the cabling and the number of ports (Switches) that would need to be available to house 50 physical servers.

Just think about the UPS solution, you can now opt for a UPS to support 2 physical servers plus storage rather than 50 physical servers.

Assurance, you can now pay for support / maintenance on 2 servers rather than 50.

Future proofing, because your servers are virtual you do not need to be worried when updating your physical servers. You can simply configure the new physical server, then vMotion your virtual servers over and decommission the old server.