<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wirey.com</title>
	<atom:link href="http://wirey.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wirey.com</link>
	<description>A blog of general wireyness...</description>
	<lastBuildDate>Wed, 24 Mar 2010 11:57:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Patching ESX(i) using PowerCLI</title>
		<link>http://wirey.com/2010/03/patching-esxi-using-powercli/</link>
		<comments>http://wirey.com/2010/03/patching-esxi-using-powercli/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 20:49:23 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[ESXi]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[ROBO]]></category>

		<guid isPermaLink="false">http://wirey.com/?p=9</guid>
		<description><![CDATA[I&#8217;m working on a project at the moment to implement vSphere in a Remote Office Branch Office (ROBO) environment. For this customer, a pair of ESXi hosts will be placed at each location, with entry-level shared storage. By making use of HA and vMotion, the platform provides a reasonable level of resilience &#8211; certainly better [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project at the moment to implement vSphere in a Remote Office Branch Office (ROBO) environment. For this customer, a pair of ESXi hosts will be placed at each location, with entry-level shared storage. By making use of HA and vMotion, the platform provides a reasonable level of resilience &#8211; certainly better than the physical setup used in the past.</p>
<p>One of the specific challenges faced in ROBO deployments is network bandwidth and latency. In this case, a number of the customer&#8217;s sites have such poor connectivity that whilst vCenter will operate over the links, delivering patches via vCenter Update Manger (VUM) isn&#8217;t really viable &#8211; pushing a 250MB+ patch over a 128kbps line can saturate the link causing QoS issues for other critical traffic.</p>
<p>To work around this we&#8217;re making use of the customer&#8217;s existing tried and tested patch delivery method to get the VMware patch bundles to the remote sites. The patch bundles are staged onto a shared datastore at the site and then applied using PowerCLI.</p>
<p>One of the enhancements brought in with PowerCLI 4.0 Update 1 was the <a href="http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/Install-VMHostPatch.html">Install-VMHostPatch</a> cmdlet. It really is very simple to use and avoids having to pass host credentials in scripts as the <a href="http://www.vmware.com/pdf/vsphere4/r40/vsp_40_vcli.pdf#page=42">vihostupdate.pl command within vSphere CLI</a> requires. Carter Shanklin posted <a href="http://www.youtube.com/watch?v=gXdX4xTlCP8">a short video</a> demonstrating its use &#8211; it&#8217;s definitely worth watching.</p>
<p>Anyway&#8230; enough scene-setting. Below is the quick-n-dirty script I pulled together (with a little help from various folks) to demonstrate the concept. This script will be improved in the near future to include error handling, and I also plan to more accurately document the project. I&#8217;ll update this post at that time.</p>
<pre class="brush: powershell;">
##################################################################
# ROBO Cluster patching script by Rob Upham - r o b @ vmware.com #
# Script assumes a two-node cluster with vMotion but no DRS      #
##################################################################

##########################################
# Edit these values to suit your cluster #
# and the patch being applied            #
##########################################

$VC = &quot;robo-vc-x64.vmwdemo.com&quot;
$host1 = &quot;esx-robo-1.vmwdemo.com&quot;
$host2 = &quot;esx-robo-2.vmwdemo.com&quot;
$patchpath = &quot;/vmfs/volumes/Template-FC-EMC/Patches/ESXi400-201002001/metadata.zip&quot;
#Patch bundles should be unzipped, placed on shared VMFS or NFS storage and the metadata.zip file referenced above
# e.g. $patchpath = &quot;/vmfs/volumes/NFS-Vol1/Patches/ESXi400-200912001/metadata.zip&quot;

########################
# Work gets done below #
########################

#Connect to vCenter Server
Write-Host &quot;Connecting to vCenter Server&quot;
Connect-VIServer -Server $VC

#Get host objects
$VMHostObj1 = Get-VMHost $Host1
$VMHostObj2 = Get-VMHost $Host2

#Check current build numbers
Write-Host &quot;Hosts to be patched are:&quot;
Write-Host &quot;Host1 = $host1&quot;
$VMHostObj1 | get-view -Property Name,Config.Product | select Name,{$_.Config.Product.Fullname}
Write-Host &quot;Host2 = $host2&quot;
$VMHostObj2 | get-view -Property Name,Config.Product | select Name,{$_.Config.Product.Fullname}

#Host 1
#Move vms to Host 2 and enable maintenance mode
Write-Host &quot;Moving VMs from $host1 to $host2&quot;
$VMHostObj1 | get-vm | move-vm -destination ($VMHostObj2)

Write-Host &quot;$host1 entering maintenance mode&quot;
$VMHostObj1 | set-vmhost –state maintenance

#Update host 1
Write-Host &quot;Patching $host1 with patch $patchpath&quot;
$VMHostObj1 | Install-VMHostPatch -HostPath $patchpath

#Reboot the ESX Server host 1
$VMhostObj1 | Restart-VMHost -Confirm:$false
Write-Host &quot;Waiting 2.5 minutes for $host1 to reboot&quot;
Sleep 150

$VMHostState = (Get-VMHost -Name $host1 -ErrorAction SilentlyContinue).State
While ($VMHostState -eq &quot;NotResponding&quot;){
  Write-Host &quot;ESX Server state is&quot; $VMHostState
  Write-Host &quot;Waiting 20 seconds until ESX Server starts responding&quot;
  sleep 20
  $VMHostState = (Get-VMHost -Name $host1).State
}
Write-Host &quot;Taking ESX Server host out of Maintenance Mode&quot;
$VMHostObj1 | set-vmhost –state connected
Write-Host &quot;Patching $host1 complete&quot;

#Host 2
#Move vms to Host 1 and enable maintenance mode
Write-Host &quot;Moving VMs from $host2 to $host1&quot;
$VMHostObj2 | get-vm | move-vm -destination ($VMHostObj1)

Write-Host &quot;$host2 entering maintenance mode&quot;
$VMHostObj2 | set-vmhost –state maintenance

#Update host 2
Write-Host &quot;Patching $host2 with patch $patchpath&quot;
$VMHostObj2 | Install-VMHostPatch -HostPath $patchpath

#Reboot the ESX Server host 2
$VMhostObj2 | Restart-VMHost -Confirm:$false
Write-Host &quot;Waiting 2.5 minutes for $host2 to reboot&quot;
Sleep 150

$VMHostState = (Get-VMHost -Name $host2 -ErrorAction SilentlyContinue).State
While ($VMHostState -eq &quot;NotResponding&quot;){
  Write-Host &quot;ESX Server state is&quot; $VMHostState
  Write-Host &quot;Waiting 20 seconds until ESX Server starts responding&quot;
  sleep 20
  $VMHostState = (Get-VMHost -Name $host2).State
}
Write-Host &quot;Taking ESX Server host out of Maintenance Mode&quot;
$VMHostObj2 | set-vmhost –state connected
Write-Host &quot;Patching $host2 complete&quot;
Write-Host &quot;Build numbers are now as follows:&quot;
$VMHostObj1 | get-view -Property Name,Config.Product | select Name,{$_.Config.Product.Fullname}
$VMHostObj2 | get-view -Property Name,Config.Product | select Name,{$_.Config.Product.Fullname}
Write-Host &quot;All patching complete&quot;</pre>
<p><em>Updated 24 March 10 with tweaks suggested by <a href="http://twitter.com/cshanklin">Carter</a> and <a href="http://virtu-al.net/">Alan</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://wirey.com/2010/03/patching-esxi-using-powercli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Content</title>
		<link>http://wirey.com/2009/04/content/</link>
		<comments>http://wirey.com/2009/04/content/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 21:56:15 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wirey.com/?p=3</guid>
		<description><![CDATA[I guess it would be good to put some content here.
I&#8217;m sure I&#8217;ll get round to it when I think of something worth sharing with the world.
]]></description>
			<content:encoded><![CDATA[<p>I guess it would be good to put some content here.</p>
<p>I&#8217;m sure I&#8217;ll get round to it when I think of something worth sharing with the world.</p>
]]></content:encoded>
			<wfw:commentRss>http://wirey.com/2009/04/content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
