<?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>Upgrade Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/tag/upgrade/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/tag/upgrade/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Tue, 16 Oct 2012 07:41:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>Upgrade Archives - LucD notes</title>
	<link>https://www.lucd.info/tag/upgrade/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>Update a remote server to ESXi 5.1</title>
		<link>https://www.lucd.info/2012/10/15/update-a-remote-server-to-esxi-5-1/</link>
					<comments>https://www.lucd.info/2012/10/15/update-a-remote-server-to-esxi-5-1/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Mon, 15 Oct 2012 21:34:40 +0000</pubDate>
				<category><![CDATA[ESXi]]></category>
		<category><![CDATA[Lab Adventures]]></category>
		<category><![CDATA[Home Lab]]></category>
		<category><![CDATA[Upgrade]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4122</guid>

					<description><![CDATA[With my new HaaS based home lab, I experience some limitations I need [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>With my new<strong> HaaS</strong> based home lab, I experience some limitations I need to live with. There is for example no way to insert a CD or DVD, nor can I use any USB key or a network boot.</p>
<p>That means that some of the procedures I have been using since long, need to be reviewed and updated. The next post describes one of the practical problems I encountered.</p>
<p>How do you remotely upgrade an ESXi server to version 5.1 ?</p>
<p>But as you can imagine, everything is &#8220;<em>posh</em>&#8220;-able. I was able to automate a manual procedure, and more important, I was able to upgrade my ESXi server to 5.1.</p>
<h2><span id="more-4122"></span></h2>
<h2>Short Intro</h2>
<p>The hardware I used at home to develop and test my scripts finally reached the stage where it did not perform well enough to let me run all the components and scripts I wanted to use.</p>
<p>After some considerations, and a great tip from <a href="https://twitter.com/VFrontDe" target="_blank">Andreas</a>, I went for a solution similar to the one he described in his <a href="https://www.v-front.de/search?q=sbhvl" target="_blank">SBHVL posts</a>. Make to sure to read his posts if you&#8217;re also in the market for a new and affordable home lab.</p>
<p>I now have a home lab that uses a <strong>Hardware as a Service</strong> (HaaS) environment.</p>
<p>In this and future posts I&#8217;m going to describe some of the scripts I use to manage and maintain this home lab. Since I don&#8217;t have any physical access to the lab, I will need to use different techniques then the ones I&#8217;m used to.</p>
<p>And since I&#8217;m very much into automation, I try to have all the interventions done through PowerCLI.</p>
<p>I hope you can use some of the scripts that will follow in this series in your own environments, or that they at least will give you some ideas how to automate some of your tasks.</p>
<h2>The Update Method</h2>
<p>The method that is used in the following script is not new.</p>
<p>The complete procedure is documented in the <strong>vSphere 5.1</strong> documentation in the <strong>Upgrade</strong> manual, in the <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.vsphere.upgrade.doc/GUID-E51C5DB6-F28E-42E8-ACA4-0EBDD11DF55D.html" target="_blank">Update a Host with Image Profiles</a> section.</p>
<p>The procedure was first described by <a href="https://twitter.com/VFrontDe" target="_blank">Andreas</a> in his <a href="https://www.v-front.de/2012/09/how-to-update-your-free-whitebox-esxi.html" target="_blank">How to update your (free / whitebox) ESXi server to ESXi 5.1</a> post. And later mentioned by <a href="https://twitter.com/lamw" target="_blank">William</a> in his <a href="https://www.virtuallyghetto.com/2012/09/a-pretty-cool-method-of-upgrading-to.html" target="_blank">A Pretty Cool Method of Upgrading to ESXi 5.1</a> post.</p>
<p>But both posts require you to use a <strong>SSH</strong> connection and type in the <strong>esxcli</strong> command(s) from there. That is not really what we want to do in <strong>automation</strong> circles <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>So this is my PowerCLI script that you can use to update your remote ESXi server to 5.1.</p>
<h2>The Script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$esxIP = &quot;192.168.1.1&quot;
$user = &quot;root&quot;
$password = &quot;MySecretPassword&quot;
$dsName = &quot;DS1&quot;
$depotName = &quot;Patches/VMware-ESXi-5.1.0-799733-depot.zip&quot;
$esxProfile = &quot;-standard&quot;

$path = (Get-Datastore -Name $dsName).ExtensionData.Summary.Url
$fullPathToDepot = $path + &quot;/&quot; + $depotName

$dryrun = $null
$force = $null
$maintenancemode = $null
$noliveinstall = $null
$nosigcheck = $null
$oktoremove = $true
$proxy = $null

Connect-VIServer -Server $esxIP -User $user -Password $password

$esx = Get-VMHost -Name $esxIP

Set-VMHost -VMHost $esx -State Maintenance -Confirm:$false

$esxcli = Get-EsxCli
$profileStandard = $esxcli.software.sources.profile.list($fullPathToDepot) |
	where {$_.Name -match $esxProfile} | Select -ExpandProperty Name

$esxcli.software.profile.install($fullPathToDepot,$dryrun,$force,$maintenancemode,
			$noliveinstall,$nosigcheck,$oktoremove,$profileStandard,$proxy)

Restart-VMHost -VMHost $esx -Confirm:$false</pre><p></p>
<h3>Annotation</h3>
<p><strong>Line 1-3</strong>: Connection information for the Connect-VIServer cmdlet</p>
<p><strong>Line 4</strong>: The name of the datastore where the &#8220;depot&#8221; file is stored</p>
<p><strong>Line 5</strong>: The folder that contains the &#8220;depot&#8221; file and the filename of the &#8220;depot&#8221;</p>
<p><strong>Line 6</strong>: The serach string that will allow the script to select the required profile from the &#8220;depot&#8221;. This specific &#8220;depot&#8221; file for ESXi 5.1 contains 2 profiles, <strong>ESXi-5.1.0-799733-no-tools</strong> and <strong>ESXi-5.1.0-799733-standard</strong>. In the script we take the &#8220;standard&#8221; profile.</p>
<p><strong>Line 8-9</strong>: Assemble the full path to the &#8220;depot&#8221; file.</p>
<p><strong>Line 11-17</strong>: The esxcli command we will use has a number of parameters. Most of these are not needed for what we want to do, but to actually upgrade the ESXi host to 5.1, we need to set the &#8220;oktoremove&#8221; parameter to $true.</p>
<p><strong>Line 23</strong>: Set the ESXi server in maintenance mode.</p>
<p><strong>Line 25</strong>: From PowerCLI we use the Get-EsxCli cmdlet to set up an interface to the esxcli command.</p>
<p><strong>Line 26-27</strong>: Get the full name of the &#8220;standard&#8221; profile.</p>
<p><strong>Line 29-30</strong>: Prepare the upgrade process.</p>
<p><strong>Line 32</strong>: Reboot the ESXi server to start the actual upgrade. At this stage you might see an error in the script. That&#8217;s caused by the fact that the server is rebooting while we still have active open connections from the script.</p>
<h2>The Result</h2>
<p>After the reboot, if all went well, the ESXi server will be running version 5.1. If there were problems, check the content of the log file at <strong>/var/log/esxupdate.log</strong>. It might contain some clues.</p>
<p>You will have to get the ESXi server out of maintenance mode.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2012/10/15/update-a-remote-server-to-esxi-5-1/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
