<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>ICT-Freak.nl</title>
	<atom:link href="http://ict-freak.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://ict-freak.nl</link>
	<description>VMware, Windows, Citrix, Linux, Scripting...</description>
	<lastBuildDate>Wed, 03 Mar 2010 14:13:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ict-freak.nl' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9f0af381794bfe42194f4bc92c8e84b9?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>ICT-Freak.nl</title>
		<link>http://ict-freak.nl</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ict-freak.nl/osd.xml" title="ICT-Freak.nl" />
	<atom:link rel='hub' href='http://ict-freak.nl/?pushpress=hub'/>
		<item>
		<title>Release: PowerCLI Update Manager cmdlets</title>
		<link>http://ict-freak.nl/2010/03/03/release-powercli-update-manager-cmdlets/</link>
		<comments>http://ict-freak.nl/2010/03/03/release-powercli-update-manager-cmdlets/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 06:44:16 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Update Manager]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/03/03/release-powercli-update-manager-cmdlets/</guid>
		<description><![CDATA[ 
Just saw the news on Twitter. The PowerCLI Update Manager cmdlets are back!
Quote from the PowerCLI blog:
Cmdlet Name
Cmdlet Description
Attach-Baseline
Attaches baselines to the specified Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp objects.     Attaching a baseline to a container object such as a folder or datacenter transitively attaches the baseline to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4674&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/03/image8.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb8.png?w=89&#038;h=75" width="89" height="75" /></a> </p>
<p>Just saw the news on Twitter. The PowerCLI Update Manager cmdlets are back!</p>
<p>Quote from the <a href="http://blogs.vmware.com/vipowershell/2010/03/now-available-powercli-cmdlets-for-vcenter-update-manager.html" target="_blank">PowerCLI blog</a>:</p>
<blockquote><p>Cmdlet Name</p>
<p>Cmdlet Description</p>
<p><strong>Attach-Baseline</strong></p>
<p>Attaches baselines to the specified Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp objects.     <br />Attaching a baseline to a container object such as a folder or datacenter transitively attaches the baseline to all objects in the container.</p>
<p><strong>Detach-Baseline</strong></p>
<p>Detaches baselines from the specified inventory objects.</p>
<p><strong>Download-Patch</strong></p>
<p>Downloads new patches into the Update Manager patch repository from the enabled patch download sources.</p>
<p><strong>Get-Baseline</strong></p>
<p>Retrieves the baselines specified by the provided cmdlet</p>
<p>parameters.</p>
<p><strong>Get-Compliance</strong></p>
<p>Retrieve baseline compliance data for the specified object of type Template, VirtualMachine, VMHost, Cluster, Datacenter, Folder, and VApp.</p>
<p><strong>Get-Patch</strong></p>
<p>Retrieves all available patches or those specified by the provided cmdlet parameters.</p>
<p><strong>Get-PatchBaseline</strong></p>
<p>Retrieves all patch baselines or those specified by the provided cmdlet parameters.</p>
<p><strong>New-PatchBaseline</strong></p>
<p>Creates a new patch baseline. Patch baselines can be applied to either hosts or virtual machines. Depending on the patch criteria you select, patch baselines can be either dynamic or static (fixed). </p>
<p><strong>Remediate-Inventory</strong></p>
<p>Remediates an inventory object against the specified baselines.</p>
<p><strong>Remove-Baseline</strong></p>
<p>Deletes the specified baselines from their servers. Before the</p>
<p>removal, the baselines are detached from all entities they have been attached to.</p>
<p><strong>Scan-Inventory</strong></p>
<p>Scans inventory objects for baselines attached to them.</p>
<p><strong>Set-PatchBaseline</strong></p>
<p>Modifies the properties of a patch baseline. You can specify explicitly the patches you want to include in the baseline through the IncludePatch parameter.</p>
<p><strong>Stage-Patch</strong></p>
<p>Initializes staging of patches. Staging allows you to download</p>
<p>patches from the Update Manager server to the ESX/ESXi hosts, without applying the patches immediately.</p>
</blockquote>
<p>&#160;</p>
<p>Download and more information can be found here: <a title="http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli/updatemanager" href="http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli/updatemanager" target="_blank">http://communities.vmware.com/</a></p>
<p>Release Notes can be found here: <a title="http://communities.vmware.com/docs/DOC-12075" href="http://communities.vmware.com/docs/DOC-12075">http://communities.vmware.com/docs/DOC-12075</a></p>
<p>The online manual can be found here: <a title="http://www.vmware.com/support/developer/ps-libs/vumps/vumps40u1/html/index.html" href="http://www.vmware.com/support/developer/ps-libs/vumps/vumps40u1/html/index.html" target="_blank">http://www.vmware.com/</a></p>
<p>&#160;</p>
<p>You need to install PowerCLI 4 update 1 before you install the Update Manager cmdlets</p>
<br />Filed under: <a href='http://ict-freak.nl/category/automation/'>Automation</a>, <a href='http://ict-freak.nl/category/virtualization/vmware/'>VMware</a> Tagged: <a href='http://ict-freak.nl/tag/powercli/'>PowerCLI</a>, <a href='http://ict-freak.nl/tag/update-manager/'>Update Manager</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4674/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4674&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/03/03/release-powercli-update-manager-cmdlets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>An important vSphere 4 storage bug is solved in patch ESX400-200912401-BG</title>
		<link>http://ict-freak.nl/2010/02/25/vsphere-apd-bug-is-solved-in-patch-esx400-200912401-bg/</link>
		<comments>http://ict-freak.nl/2010/02/25/vsphere-apd-bug-is-solved-in-patch-esx400-200912401-bg/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 08:19:04 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[APD]]></category>
		<category><![CDATA[iSCSI]]></category>
		<category><![CDATA[Patches]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[VUM]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/?p=4646</guid>
		<description><![CDATA[
Chad Sakac over at http://virtualgeek.typepad.com already blogged about the APD bug in December last year. You can find his post here.&#160;
Just a short quote from Chad his post about the symptoms of this APD bug:
Recently saw a little uptick (still a small number) in customers running into a specific issue – and I wanted to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4646&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/03/image2.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb2.png?w=204&#038;h=38" width="204" height="38" /></a></p>
<p>Chad Sakac over at <a href="http://virtualgeek.typepad.com/virtual_geek/2009/12/an-important-vsphere-4-storage-bug-and-workaround.html" target="_blank">http://virtualgeek.typepad.com</a> already blogged about the APD bug in December last year. You can find his post <a title="http://virtualgeek.typepad.com/virtual_geek/2009/12/an-important-vsphere-4-storage-bug-and-workaround.html" href="http://virtualgeek.typepad.com/virtual_geek/2009/12/an-important-vsphere-4-storage-bug-and-workaround.html" target="_blank">here.</a>&#160;</p>
<p>Just a short quote from Chad his post about the symptoms of this APD bug:</p>
<blockquote><p>Recently saw a little uptick (still a small number) in customers running into a specific issue – and I wanted to share the symptom and resolution.&#160;&#160; Common behavior:</p>
<ol>
<li>They want to remove a LUN from a vSphere 4 cluster </li>
<li>They move or Storage vMotion the VMs off the datastore who is being removed (otherwise, the VMs would hard crash if you just yank out the datastore) </li>
<li>After removing the LUN, VMs on OTHER datastores would become unavailable (not crashing, but becoming periodically unavailable on the network) </li>
<li>the ESX logs would show a series of errors starting with “NMP” </li>
</ol>
<p>Examples of the error messages include:</p>
<ol>
<p>“NMP: nmp_DeviceAttemptFailover: Retry world failover device &quot;naa._______________&quot; &#8211; failed to issue command due to Not found (APD)”</p>
<p>“NMP: nmp_DeviceUpdatePathStates: Activated path &quot;NULL&quot; for NMP device &quot;naa.__________________&quot;.</p>
</ol>
<p>What a weird one…&#160;&#160; I also found that this was affecting multiple storage vendors (suggesting an ESX-side issue).&#160; You can see the <a href="http://communities.vmware.com/message/1321985#1321985">VMTN thread on this here</a>.</p>
</blockquote>
<p>&#160;</p>
<p>We found out about this issue during a big storage project. We where creating a lot of new LUNs and where removing a lot of the old LUNs. If you remove a LUN on a way not mentioned in Chad his post:</p>
<blockquote><p>This workaround falls under “operational excellence”.&#160;&#160; The sequence of operations here is important – the issue only occurs if the LUN is removed while the datastore and disk device are expected by the ESX host.&#160;&#160; The correct sequence for removing a LUN backing a datastore.</p>
<ol>
<li>In the vSphere client, vacate the VMs from the datastore being removed (migrate or Storage vMotion) </li>
<li>In the vSphere client, remove the Datastore </li>
<li>In the vSphere client, remove the storage device </li>
<li>Only then, in your array management tool remove the LUN from the host. </li>
<li>In the vSphere client, rescan the bus. </li>
</ol>
</blockquote>
<p>So when we used the workaround described above, everything went fine. But at my current employer, we use a large LeftHand iSCSI SAN.&#160; One of the great things of Lefthand SAN is the ability to move LUNs between different clusters. With the APD bug, we couldn’t use this option anymore.</p>
<p>When we discovered this APD bug we contacted VMware Support. After a couple of weeks we received an e-mail with the following fix.</p>
<blockquote><p>I can now confirm that the APD (All paths dead) issue has been resolved by a patch released as part of P03.</p>
<p>To install this patch, please upgrade your hosts to vSphere Update 1 and use Update Manager to install the latest patches.</p>
<p>Please ensure that ESX400-200912401-BG is installed as this resolves the APD problem</p>
</blockquote>
<p>We upgraded one of our clusters to Update 1 and installed the latest patches including the ESX400-200912401-BG patch. After installing the patch, we did some tests and I can confirm that the APD bug is history!!</p>
<p>To reproduce this issue I created two iSCSI LUNs on the EMC VSA. Instead of removing the LUNs I disconnected the iSCSI network to simulate this. So before I disconnected the iSCSI network, all LUNs are working just fine:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb.png?w=644&#038;h=256" width="644" height="256" /></a></p>
<p>After I disconnected the iSCSI network and waited a while, all the paths to the EMC LUNs are dead and they are colored red:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb1.png?w=644&#038;h=272" width="644" height="272" /></a></p>
<p>This is just normal behavior but before installing the ESX400-200912401-BG patch, the ESX host will stall for 30 till 60 seconds. This means that all the VMs running on a host of which a LUN was disconnected will stall, even though the VM is on a different datastore!! I am happy that VMware has solved this APD bug.</p>
<p>&#160;</p>
<p>If you want to make sure if you already installed the APD patch, you can easily verify this with the vCenter Update Manager.</p>
<p>Go to the tab Update Manager and open the Admin View. Add a new baseline. Select the Host Patch option:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image3.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb3.png?w=641&#038;h=484" width="641" height="484" /></a> </p>
<p>In the next screen select Fixed:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image4.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb4.png?w=641&#038;h=484" width="641" height="484" /></a>&#160; </p>
<p>Now we are going to create a filter. Enter the name of the patch:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image5.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb5.png?w=629&#038;h=413" width="629" height="413" /></a> </p>
<p>Select the ESX400-200912401-BG patch:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image6.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb6.png?w=641&#038;h=484" width="641" height="484" /></a> </p>
<p>When the new baseline is ready, return to the Compliance view and attach the new baseline:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/03/image7.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/03/image_thumb7.png?w=498&#038;h=567" width="498" height="567" /></a> </p>
<p>The final step is to perform a scan on your Datacenter, Cluster or ESX Host. Now wait and see if the patch is already installed or not.</p>
<p>&#160;</p>
<p>More info about the patch can be found here:</p>
<ul>
<li><a title="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1016291" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1016291" target="_blank">http://kb.vmware.com/kb1016291</a>&#160; </li>
</ul>
<p>For the readers who cannot upgrade to vSphere Update 1 and the latest patches, you can find some workarounds here:</p>
<ul>
<li><a title="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1016626" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1016626" target="_blank">http://kb.vmware.com/kb1016626</a> </li>
<li><a title="http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=1015084&amp;sliceId=1&amp;docTypeID=DT_KB_1_1&amp;dialogID=1683461&amp;stateId=0%200%201681802" href="http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=1015084&amp;sliceId=1&amp;docTypeID=DT_KB_1_1&amp;dialogID=1683461&amp;stateId=0%200%201681802">http://kb.vmware.com/kb1015084</a> </li>
<li><a title="http://virtualgeek.typepad.com/virtual_geek/2009/12/an-important-vsphere-4-storage-bug-and-workaround.html" href="http://virtualgeek.typepad.com/virtual_geek/2009/12/an-important-vsphere-4-storage-bug-and-workaround.html" target="_blank">http://virtualgeek.typepad.com</a> </li>
</ul>
<br />Filed under: <a href='http://ict-freak.nl/category/virtualization/vmware/'>VMware</a> Tagged: <a href='http://ict-freak.nl/tag/apd/'>APD</a>, <a href='http://ict-freak.nl/tag/iscsi/'>iSCSI</a>, <a href='http://ict-freak.nl/tag/patches/'>Patches</a>, <a href='http://ict-freak.nl/tag/vsphere/'>vSphere</a>, <a href='http://ict-freak.nl/tag/vum/'>VUM</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4646/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4646/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4646/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4646&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/02/25/vsphere-apd-bug-is-solved-in-patch-esx400-200912401-bg/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/03/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerCLI: Return Datastore name by Canonical name</title>
		<link>http://ict-freak.nl/2010/02/09/powercli-return-datastore-name-by-canonical-name/</link>
		<comments>http://ict-freak.nl/2010/02/09/powercli-return-datastore-name-by-canonical-name/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 16:42:15 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VESI]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/02/09/powercli-return-datastore-name-by-canonical-name/</guid>
		<description><![CDATA[ 
When you are troubleshooting an ESX host, you can see a lot off warnings in the VMKERNEL log:
Jan 29 16:15:34 esx02.ict-freak.local vmkernel: 9:23:45:33.917 cpu1:4210)WARNING: NMP: nmp_DeviceAttemptFailover:
Retry world failover device &#8220;t10.9454450000000000000000001000000056900000D0000000&#8243; &#8211; issuing command 0&#215;4100041f0c00
But which datastore belongs to the Canonical name mentioned in the VMKERNEL log??
The following script will return the Datastore name. Thanks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4644&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://ictfreak.files.wordpress.com/2010/01/image_thumb11.png?w=240&amp;h=101" alt="" /> <img src="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png?w=89&amp;h=75&amp;h=75" alt="" /></p>
<p>When you are troubleshooting an ESX host, you can see a lot off warnings in the VMKERNEL log:</p>
<blockquote><p>Jan 29 16:15:34 esx02.ict-freak.local vmkernel: 9:23:45:33.917 cpu1:4210)WARNING: NMP: nmp_DeviceAttemptFailover:<br />
Retry world failover device &#8220;t10.9454450000000000000000001000000056900000D0000000&#8243; &#8211; issuing command 0&#215;4100041f0c00</p></blockquote>
<p>But which datastore belongs to the Canonical name mentioned in the VMKERNEL log??</p>
<p>The following script will return the Datastore name. Thanks @Lucd22 for the help!!</p>
<pre><span style="color:#800080;">$esxhost</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">esx1.ict-freak.local</span><span style="color:#800000;">"</span><span style="color:#000000;">
</span><span style="color:#800080;">$id</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">t10.9454450000000000000000001000000056900000D0000000</span><span style="color:#800000;">"</span><span style="color:#000000;">

</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$ds</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="color:#800080;">$esxhost</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Get-Datastore</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">where</span><span style="color:#000000;">{</span><span style="color:#800080;">$_</span><span style="color:#000000;">.Type </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">vmfs</span><span style="color:#800000;">"</span><span style="color:#000000;">} | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">)){

    </span><span style="color:#800080;">$ds</span><span style="color:#000000;">.Info.Vmfs.Extent | </span><span style="color:#5f9ea0;font-weight:bold;">%</span><span style="color:#000000;">{
         </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$_</span><span style="color:#000000;">.DiskName </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">$id</span><span style="color:#000000;">){
            </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800080;">$ds</span><span style="color:#000000;">.Info.Name </span><span style="color:#800080;">$_</span><span style="color:#000000;">.DiskName
        }
    }
}</span></pre>
<p>The output will look like this:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image2.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb2.png?w=644&#038;h=218" border="0" alt="image" width="644" height="218" /></a></p>
<p>Ok, this is a nice script to have in you toolbox, but I hear you think,  how do I add it to the VESI?.</p>
<p>First you need to create a new folder, if you don’t use any other Powerpack.</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image3.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb3.png?w=437&#038;h=222" border="0" alt="image" width="437" height="222" /></a></p>
<p>Give the folder a name. I used the name Personal scripts:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image4.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb4.png?w=564&#038;h=208" border="0" alt="image" width="564" height="208" /></a></p>
<p>The next step is to add a new script node:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image5.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb5.png?w=564&#038;h=572" border="0" alt="image" width="564" height="572" /></a></p>
<p>The last step is to paste the following code into the new created script node:</p>
<pre><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$global:defaultviservers</span><span style="color:#000000;">) {
    </span><span style="color:#800080;">$id</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Read-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Enter the Canonical Name (naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)</span><span style="color:#800000;">"</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$esx</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;">)){
        </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$ds</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="color:#800080;">$esx</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-Datastore</span><span style="color:#000000;"> | `
        </span><span style="color:#5f9ea0;font-weight:bold;">where</span><span style="color:#000000;">{</span><span style="color:#800080;">$_</span><span style="color:#000000;">.Type </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">vmfs</span><span style="color:#800000;">"</span><span style="color:#000000;">} | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">)){
            </span><span style="color:#800080;">$Details</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;"> |</span><span style="color:#5f9ea0;font-weight:bold;">Select-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">DataStore</span><span style="color:#000000;">
                </span><span style="color:#800080;">$ds</span><span style="color:#000000;">.Info.Vmfs.Extent | </span><span style="color:#5f9ea0;font-weight:bold;">%</span><span style="color:#000000;">{
                 </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$_</span><span style="color:#000000;">.DiskName </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">$id</span><span style="color:#000000;">){
                    </span><span style="color:#800080;">$Details</span><span style="color:#000000;">.DataStore </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$ds</span><span style="color:#000000;">.Info.Name
                }
               }
        }
        </span><span style="color:#800080;">$Details</span><span style="color:#000000;">.PSTypeNames.Clear()
        </span><span style="color:#800080;">$Details</span><span style="color:#000000;">
    }
}
</span><span style="color:#0000ff;">Else</span><span style="color:#000000;"> {
    [</span><span style="color:#008080;">System.Windows.Forms.MessageBox</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">Show</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">You must connect to one or more hosts before you can use this node. Please click on the </span><span style="color:#800000;">''</span><span style="color:#800000;">Managed Hosts</span><span style="color:#800000;">''</span><span style="color:#800000;"> node of the VMware PowerPack, connect to one or more of the servers you have configured there, and then try again.</span><span style="color:#800000;">'</span><span style="color:#000000;">,</span><span style="color:#800000;">'</span><span style="color:#800000;">Connection not established</span><span style="color:#800000;">'</span><span style="color:#000000;">,[</span><span style="color:#008080;">System.Windows.Forms.MessageBoxButtons</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">OK</span><span style="color:#000000;">,[</span><span style="color:#008080;">System.Windows.Forms.MessageBoxIcon</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">Information</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
}</span></pre>
<p>If you want to run this script, you have to connect to vCenter first. Open VMware – Managed Hosts:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image6.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb6.png?w=644&#038;h=348" border="0" alt="image" width="644" height="348" /></a></p>
<p>Click on Add managed host… to add a server:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image7.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb7.png?w=545&#038;h=428" border="0" alt="image" width="545" height="428" /></a></p>
<p>To connect to the new added vCenter server, press the connect under actions. To run the script click on the new create script node and enter a Canonical Name.</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image8.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb8.png?w=545&#038;h=181" border="0" alt="image" width="545" height="181" /></a></p>
<p>And the script will return the Datastore name:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image9.png"><img style="display:inline;border:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb9.png?w=333&#038;h=467" border="0" alt="image" width="333" height="467" /></a></p>
<p>Now you are able to convert the Canonical name to the Datastore Name.</p>
<br />Filed under: <a href='http://ict-freak.nl/category/automation/'>Automation</a>, <a href='http://ict-freak.nl/category/virtualization/vmware/'>VMware</a> Tagged: <a href='http://ict-freak.nl/tag/powercli/'>PowerCLI</a>, <a href='http://ict-freak.nl/tag/vesi/'>VESI</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4644/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4644&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/02/09/powercli-return-datastore-name-by-canonical-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb11.png?w=240&#38;h=101" medium="image" />

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png?w=89&#38;h=75&#38;h=75" medium="image" />

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>VMware Tools: Uninstall failed. Please correct the failure</title>
		<link>http://ict-freak.nl/2010/02/06/vmware-tools-uninstall-failed-please-correct-the-failure/</link>
		<comments>http://ict-freak.nl/2010/02/06/vmware-tools-uninstall-failed-please-correct-the-failure/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 22:02:45 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[VMware Tools]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/02/06/vmware-tools-uninstall-failed-please-correct-the-failure/</guid>
		<description><![CDATA[ 
Today a ran into an issue with the VMware Tools installer on Linux:
 
The solution was simple this time. Just remove the locations file from from /etc/vmware-tools. You can do this by running the following command:
rm –f /etc/vmware-tools/locations
Now you are able to run the VMware Tool installer again. If you are installing the VMware [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4626&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/02/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb.png?w=204&#038;h=38" width="204" height="38" /></a> </p>
<p>Today a ran into an issue with the VMware Tools installer on Linux:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/02/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/02/image_thumb1.png?w=644&#038;h=451" width="644" height="451" /></a> </p>
<p>The solution was simple this time. Just remove the <strong>locations</strong> file from from <strong>/etc/vmware-tools</strong>. You can do this by running the following command:</p>
<p><strong>rm –f /etc/vmware-tools/locations</strong></p>
<p>Now you are able to run the VMware Tool installer again. If you are installing the VMware Tools on it default locations, you can add the –default parameter to the ./vmware-install.pl command to install the VMware Tools on it’s default location.</p>
<p>Source: <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1013159" target="_blank">KB1013159</a></p>
<br />Filed under: <a href='http://ict-freak.nl/category/virtualization/vmware/'>VMware</a> Tagged: <a href='http://ict-freak.nl/tag/centos/'>CentOS</a>, <a href='http://ict-freak.nl/tag/linux/'>Linux</a>, <a href='http://ict-freak.nl/tag/vmware-tools/'>VMware Tools</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4626/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4626/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4626/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4626&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/02/06/vmware-tools-uninstall-failed-please-correct-the-failure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Backup and Restore DRS Rules with the VESI</title>
		<link>http://ict-freak.nl/2010/01/28/backup-and-restore-drs-rules-with-the-vesi/</link>
		<comments>http://ict-freak.nl/2010/01/28/backup-and-restore-drs-rules-with-the-vesi/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:17:59 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VESI]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/01/28/backup-and-restore-drs-rules-with-the-vesi/</guid>
		<description><![CDATA[ 
In this short video I demonstrate another script which I integrated into the VESI. The video will show&#160; how to create a backup of your DRS rules and how to restore&#160; a DRS rule from a previous backup:



The original script can be found in this post.
Filed under: Automation, VMware Tagged: PowerCLI, VESI, Youtube  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4619&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/01/image12.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb12.png?w=240&#038;h=101" width="240" height="101" /></a> </p>
<p>In this short video I demonstrate another script which I integrated into the VESI. The video will show&#160; how to create a backup of your DRS rules and how to restore&#160; a DRS rule from a previous backup:</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:4b39e333-8d7e-4cca-92d4-e28c8f94e1c0" class="wlWriterEditableSmartContent">
<div><span style="text-align:center; display: block;"><a href="http://ict-freak.nl/2010/01/28/backup-and-restore-drs-rules-with-the-vesi/"><img src="http://img.youtube.com/vi/N0H63yy6aXY/2.jpg" alt="" /></a></span></div>
</div>
<p>The original script can be found in this <a href="http://ict-freak.nl/2009/09/06/powercli-export-and-import-drs-rules-v2/" target="_blank">post</a>.</p>
<br />Filed under: <a href='http://ict-freak.nl/category/automation/'>Automation</a>, <a href='http://ict-freak.nl/category/virtualization/vmware/'>VMware</a> Tagged: <a href='http://ict-freak.nl/tag/powercli/'>PowerCLI</a>, <a href='http://ict-freak.nl/tag/vesi/'>VESI</a>, <a href='http://ict-freak.nl/tag/youtube/'>Youtube</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4619/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4619&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/01/28/backup-and-restore-drs-rules-with-the-vesi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/N0H63yy6aXY/2.jpg" medium="image" />
	</item>
		<item>
		<title>Move-Template integrated into the VESI</title>
		<link>http://ict-freak.nl/2010/01/27/move-template-integrated-into-the-vesi/</link>
		<comments>http://ict-freak.nl/2010/01/27/move-template-integrated-into-the-vesi/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 09:24:13 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VESI]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/01/27/move-template-integrated-into-the-vesi/</guid>
		<description><![CDATA[ 
In my previous post I showed my custom Move-Template function. This function can be used within the PowerCLI, But how cool will it be to integrate this script into the VESI. So I grabbed the PowerCLI code and build it into the VESI. The final result can be found in the following video:




Posted in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4616&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/01/image11.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb11.png?w=240&#038;h=101" width="240" height="101" /></a> </p>
<p>In my previous <a href="http://ict-freak.nl/2010/01/21/powercli-move-template/" target="_blank">post</a> I showed my custom Move-Template function. This function can be used within the PowerCLI, But how cool will it be to integrate this script into the VESI. So I grabbed the PowerCLI code and build it into the VESI. The final result can be found in the following video:</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:bb13a211-a63a-4619-8a4f-48a4d8647e42" class="wlWriterEditableSmartContent">
<div><span style="text-align:center; display: block;"><a href="http://ict-freak.nl/2010/01/27/move-template-integrated-into-the-vesi/"><img src="http://img.youtube.com/vi/_LoCskVSrn4/2.jpg" alt="" /></a></span></div>
</div>
<br />Posted in Automation, VMware Tagged: PowerCLI, VESI, Youtube <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4616/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4616/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4616/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4616/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4616/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4616/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4616/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4616/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4616/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4616/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4616&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/01/27/move-template-integrated-into-the-vesi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/_LoCskVSrn4/2.jpg" medium="image" />
	</item>
		<item>
		<title>PowerCLI: Move-Template</title>
		<link>http://ict-freak.nl/2010/01/21/powercli-move-template/</link>
		<comments>http://ict-freak.nl/2010/01/21/powercli-move-template/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:40:55 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Template]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/01/21/powercli-move-template/</guid>
		<description><![CDATA[
Storage vMotion is a great feature to Move your VMs to other datastores. But what if you want to move your Templates?
In the current version of vSphere there is no option within the Client:

So I created a PowerCLI function just to migrate the templates to another datastore.
function Move-Template{
    param( [string] $template, [string] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4609&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/01/image3.png"><img title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png?w=89&amp;h=75&#038;h=75" border="0" alt="image" width="89" height="75" /></a></p>
<p>Storage vMotion is a great feature to Move your VMs to other datastores. But what if you want to move your Templates?<br />
In the current version of vSphere there is no option within the Client:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image6.png"><img style="display:inline;border-width:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb6.png?w=447&#038;h=295" border="0" alt="image" width="447" height="295" /></a></p>
<p>So I created a PowerCLI function just to migrate the templates to another datastore.</p>
<pre><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Move-Template</span><span style="color:#000000;">{
    </span><span style="color:#0000ff;">param</span><span style="color:#000000;">( [</span><span style="color:#008080;">string</span><span style="color:#000000;">] </span><span style="color:#800080;">$template</span><span style="color:#000000;">, [</span><span style="color:#008080;">string</span><span style="color:#000000;">] </span><span style="color:#800080;">$esx</span><span style="color:#000000;">, [</span><span style="color:#008080;">string</span><span style="color:#000000;">] </span><span style="color:#800080;">$datastore</span><span style="color:#000000;">)

    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$template</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;">){</span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Enter a Template name</span><span style="color:#800000;">"</span><span style="color:#000000;">}
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$esx</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;">){</span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Enter an ESX hostname</span><span style="color:#800000;">"</span><span style="color:#000000;">}
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$esx</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-ne</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-and</span><span style="color:#000000;"> </span><span style="color:#800080;">$datastore</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;">){</span><span style="color:#800080;">$vmotion</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$true</span><span style="color:#000000;">}
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$datastore</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-ne</span><span style="color:#000000;"> </span><span style="color:#800000;">""</span><span style="color:#000000;">){</span><span style="color:#800080;">$svmotion</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$true</span><span style="color:#000000;">}

    </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Converting $template to VM</span><span style="color:#800000;">"</span><span style="color:#000000;">
    </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Set-Template</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Template</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-Template</span><span style="color:#000000;"> </span><span style="color:#800080;">$template</span><span style="color:#000000;">) </span><span style="font-style:italic;color:#5f9ea0;">-ToVM</span><span style="color:#000000;"> 

    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$svmotion</span><span style="color:#000000;">){
        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Migrate $template to $esx and $datastore</span><span style="color:#800000;">"</span><span style="color:#000000;">
        </span><span style="color:#5f9ea0;font-weight:bold;">Move-VM</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;">) </span><span style="font-style:italic;color:#5f9ea0;">-Destination</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="color:#800080;">$esx</span><span style="color:#000000;">) </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
        </span><span style="font-style:italic;color:#5f9ea0;">-Datastore</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-Datastore</span><span style="color:#000000;"> </span><span style="color:#800080;">$datastore</span><span style="color:#000000;">) </span><span style="font-style:italic;color:#5f9ea0;">-Confirm</span><span style="color:#000000;">:</span><span style="color:#800080;">$false</span><span style="color:#000000;">
        (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">).MarkAsTemplate() | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
    }        

    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$vmotion</span><span style="color:#000000;">){
        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Migrate $template to $esx</span><span style="color:#800000;">"</span><span style="color:#000000;">
        </span><span style="color:#5f9ea0;font-weight:bold;">Move-VM</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Destination</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="color:#800080;">$esx</span><span style="color:#000000;">) </span><span style="font-style:italic;color:#5f9ea0;">-Confirm</span><span style="color:#000000;">:</span><span style="color:#800080;">$false</span><span style="color:#000000;">
        (</span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">).MarkAsTemplate() | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
    }
}</span></pre>
<p>The function above can be used to move a single template via</p>
<pre><span style="color:#5f9ea0;">Move-Template</span><span style="color:#000000;"> &lt;template&gt; &lt;esxhost&gt; &lt;datastore&gt;</span></pre>
<p>But what if you want to move only your Linux Templates or Windows Templates or even all the Templates at once.  For these options, I created two extra functions.</p>
<p>First I created a function to get al the Linux templates:</p>
<pre><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-LinuxTemplates</span><span style="color:#000000;">{
    </span><span style="color:#800080;">$lnxtpl</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Template</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">where</span><span style="color:#000000;"> {</span><span style="color:#800080;">$_</span><span style="color:#000000;">.Guest.GuestFamily </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">linuxGuest</span><span style="color:#800000;">'</span><span style="color:#000000;">} | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Get-VIObjectByVIView</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> </span><span style="color:#800080;">$lnxtpl</span><span style="color:#000000;">
}</span></pre>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image7.png"><img style="display:inline;border-width:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb7.png?w=644&#038;h=122" border="0" alt="image" width="644" height="122" /></a></p>
<p>And if you want, you can also get al the Windows templates:</p>
<pre><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-WindowsTemplates</span><span style="color:#000000;">{
    </span><span style="color:#800080;">$wintpl</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Template</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">where</span><span style="color:#000000;"> {</span><span style="color:#800080;">$_</span><span style="color:#000000;">.Guest.GuestFamily </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">windowsGuest</span><span style="color:#800000;">'</span><span style="color:#000000;">} | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Get-VIObjectByVIView</span><span style="color:#000000;">
    </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> </span><span style="color:#800080;">$wintpl</span><span style="color:#000000;">
}</span></pre>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image8.png"><img style="display:inline;border-width:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb8.png?w=644&#038;h=183" border="0" alt="image" width="644" height="183" /></a></p>
<p>Now we can get all the different templates, we are able to move the templates to another host or datastore.</p>
<p>This is how you move all the templates to a new host and datastore:</p>
<pre><span style="color:#800080;">$templates</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Template</span><span style="color:#000000;">
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$templates</span><span style="color:#000000;">){
    </span><span style="color:#5f9ea0;">Move-Template</span><span style="color:#000000;"> </span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> &lt;esxhost&gt; &lt;datastore&gt;
}</span></pre>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image9.png"><img style="display:inline;border-width:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb9.png?w=644&#038;h=206" border="0" alt="image" width="644" height="206" /></a></p>
<p>If you want to move all the Linux templates, you run the following commands:</p>
<pre><span style="color:#800080;">$templates</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-LinuxTemplates</span><span style="color:#000000;">
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$templates</span><span style="color:#000000;">){
    </span><span style="color:#5f9ea0;">Move-Template</span><span style="color:#000000;"> </span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> &lt;esxhost&gt; &lt;datastore&gt;
}</span></pre>
<p>And finally, you can move all windows templates by running these commands:</p>
<pre><span style="color:#800080;">$templates</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-WindowsTemplates</span><span style="color:#000000;">
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$templates</span><span style="color:#000000;">){
    </span><span style="color:#5f9ea0;">Move-Template</span><span style="color:#000000;"> </span><span style="color:#800080;">$tpl</span><span style="color:#000000;"> &lt;esxhost&gt; &lt;datastore&gt;
}</span></pre>
<p>But how does it look when you run the function. I will do an example with the get-linuxtemplates function.</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image10.png"><img style="display:inline;border-width:0;" title="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb10.png?w=644&#038;h=172" border="0" alt="image" width="644" height="172" /></a></p>
<p>I am going to use this functions in another script and will transform it to a ready to use script for the EcoShell.</p>
<br />Posted in VMware Tagged: PowerCLI, Template <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4609/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4609&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/01/21/powercli-move-template/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png?w=89&#38;h=75" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Update Linux VMs with PowerCLI thanks to Invoke-VMScript</title>
		<link>http://ict-freak.nl/2010/01/20/update-linux-vms-with-powercli-thanks-to-invoke-vmscript/</link>
		<comments>http://ict-freak.nl/2010/01/20/update-linux-vms-with-powercli-thanks-to-invoke-vmscript/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 15:50:07 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PowerCLI]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/01/20/update-linux-vms-with-powercli-thanks-to-invoke-vmscript/</guid>
		<description><![CDATA[&#160; I created a new PowerCLI function to update the Linux Guest OS via PowerCLI. Be sure you use the check-vmware-tools script posted before: http://ict-freak.nl/2009/12/21/bash-script-auto-configure-vmware-tools-at-boot-time/
The function below will check if the VM is running Linux, if the VMware Tools are up to date and running, and last but not least it will determine the linux [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4594&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/01/image3.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png?w=89&#038;h=75" width="89" height="75" /></a>&#160; <br />I created a new PowerCLI function to update the Linux Guest OS via PowerCLI. Be sure you use the check-vmware-tools script posted before: <a title="http://ict-freak.nl/2009/12/21/bash-script-auto-configure-vmware-tools-at-boot-time/" href="http://ict-freak.nl/2009/12/21/bash-script-auto-configure-vmware-tools-at-boot-time/">http://ict-freak.nl/2009/12/21/bash-script-auto-configure-vmware-tools-at-boot-time/</a></p>
<p><span style="color:#0000ff;"><font color="#000000">The function below will check if the VM is running Linux, if the VMware Tools are up to date and running, and last but not least it will determine the linux distribution so it will run the correct update command:</font></span></p>
<pre><span style="color:#0000ff;">Function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Update-LinuxVM</span><span style="color:#000000;">{
 </span><span style="color:#0000ff;">param</span><span style="color:#000000;">(</span><span style="color:#800080;">$virtualmachine</span><span style="color:#000000;">)
 </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$virtualmachine</span><span style="color:#000000;">
 </span><span style="color:#800080;">$os</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">).Summary.Config.GuestFullName
 </span><span style="color:#800080;">$toolsStatus</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-View</span><span style="color:#000000;">).Guest.ToolsStatus
 </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$vm</span><span style="color:#000000;">.powerstate </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">PoweredOn</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">){
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$toolsStatus</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">toolsOk</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">){
        </span><span style="color:#008000;">#</span><span style="color:#008000;"> Determining Linux Distro</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$os</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-match</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">Red Hat Enterprise Linux</span><span style="color:#800000;">'</span><span style="color:#000000;">){
            </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">RedHat or CentOS installation found</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Yellow</span><span style="color:#000000;">
            </span><span style="color:#800080;">$update</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">yum clean all &amp;&amp; yum update -y</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        }
        </span><span style="color:#0000ff;">elseif</span><span style="color:#000000;">(</span><span style="color:#800080;">$os</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-match</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">Debian GNU</span><span style="color:#800000;">'</span><span style="color:#000000;">){
            </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Debian installation found</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
            </span><span style="color:#800080;">$update</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">apt-get update &amp;&amp; apt-get upgrade -y</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        }
        </span><span style="color:#0000ff;">else</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">No update possible</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Red</span><span style="color:#000000;">}

        </span><span style="color:#008000;">#</span><span style="color:#008000;"> ifconfig</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$ifconfig</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-ne</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;&quot;</span><span style="color:#000000;">){
        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Configuring IP settings $ifconfig</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Yellow</span><span style="color:#000000;">
        </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Invoke-VMScript</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-HostCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$hc</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-GuestCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$gc</span><span style="color:#000000;"> </span><span style="color:#800080;">$ifconfig</span><span style="color:#000000;">
        }

        </span><span style="color:#008000;">#</span><span style="color:#008000;"> route</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$route</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-ne</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;&quot;</span><span style="color:#000000;">){
        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Setting default gateway route $route</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Yellow</span><span style="color:#000000;">
        </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Invoke-VMScript</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-HostCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$hc</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-GuestCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$gc</span><span style="color:#000000;"> </span><span style="color:#800080;">$route</span><span style="color:#000000;">
        }

        </span><span style="color:#008000;">#</span><span style="color:#008000;"> Update command</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Running $update command</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Yellow</span><span style="color:#000000;">
        </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Invoke-VMScript</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-HostCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$hc</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-GuestCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$gc</span><span style="color:#000000;"> </span><span style="color:#800080;">$update</span><span style="color:#000000;">
        }
        </span><span style="color:#0000ff;">else</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">VMware Tools are out off date or not running</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Red</span><span style="color:#000000;"> }
    }
 </span><span style="color:#0000ff;">else</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">is not running</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-fore</span><span style="color:#000000;"> </span><span style="color:#800000;">Red</span><span style="color:#000000;"> }
}</span></pre>
<p>You can use this function with the following parameters:</p>
<pre><span style="color:#800080;">$hc</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Credential</span><span style="color:#000000;">
</span><span style="color:#800080;">$gc</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Credential</span><span style="color:#000000;">
</span><span style="color:#800080;">$ifconfig</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;&quot;</span><span style="color:#000000;">
</span><span style="color:#800080;">$route</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;&quot;</span></pre>
<p>$hc will save the Host Credentials. These are the credentials you need to authenticate with the ESX Host<br />
  <br />$gc will save the Guest Credentials. These are the credentials you need to authenticate with the Linux Guest OS. </p>
<p>$ifconfig can be used to set a temporary ip address. Example: <em>ifconfig eth0 192.168.123.166 netmask 255.255.255.0<br />
    <br /></em>$route can be used to set a temporary gateway address: <em>route add default gw 192.168.123.254</em></p>
<p>The following command will start the script:<br />
  <br /><span style="color:#5f9ea0;">Update-LinuxVM</span><span style="color:#000000;"> &lt;vmname&gt;</p>
<p>The Function in action:</p>
<p><a href="http://ictfreak.files.wordpress.com/2010/01/image5.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb5.png?w=644&#038;h=390" width="644" height="390" /></a> </span></p>
<br />Posted in VMware Tagged: Linux, PowerCLI <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4594/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4594/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4594/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4594&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/01/20/update-linux-vms-with-powercli-thanks-to-invoke-vmscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerCLI: Document the ESX Hostname of the vCenter VM</title>
		<link>http://ict-freak.nl/2010/01/05/powercli-document-the-esx-hostname-of-the-vcenter-vm/</link>
		<comments>http://ict-freak.nl/2010/01/05/powercli-document-the-esx-hostname-of-the-vcenter-vm/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 11:19:30 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[DRS]]></category>
		<category><![CDATA[HA]]></category>
		<category><![CDATA[One-Liner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vCenter]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2010/01/05/powercli-document-the-esx-hostname-of-the-vcenter-vm/</guid>
		<description><![CDATA[ 
I was reading Duncan Epping his post: http://www.yellow-bricks.com/2009/10/09/best-practices-running-vcenter-virtual-vsphere/ about Running vCenter virtual. The most of the steps described, you only have to do once but step 5 needs to be documented once in a while
5. Write a procedure to boot the vCenter / AD / DNS / SQL manually in case of a complete [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4585&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2010/01/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb.png?w=78&#038;h=66" width="78" height="66" /></a> </p>
<p>I was reading Duncan Epping his post: <a title="http://www.yellow-bricks.com/2009/10/09/best-practices-running-vcenter-virtual-vsphere/" href="http://www.yellow-bricks.com/2009/10/09/best-practices-running-vcenter-virtual-vsphere/">http://www.yellow-bricks.com/2009/10/09/best-practices-running-vcenter-virtual-vsphere/</a> about Running vCenter virtual. The most of the steps described, you only have to do once but step 5 needs to be documented once in a while</p>
<blockquote><p>5. Write a procedure to boot the vCenter / AD / DNS / SQL manually in case of a complete power outage occurs.</p>
</blockquote>
<p>Nobody likes to document this thing so we will let PowerCLI do this job for us.</p>
<p>First you need to now the VMs. In most cases this will be your Domain Controller, Database Server and of course the vCenter VM.</p>
<pre><span style="color:#800080;">$vms</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;">  </span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">DC01</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">DB01</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">VC01</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Sort</span><span style="color:#000000;"> </span><span style="color:#800000;">Name</span><span style="color:#000000;">
</span><span style="color:#800080;">$vms</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Select</span><span style="color:#000000;"> Name, @{N</span><span style="color:#ff0000;">=</span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Cluster</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">;E</span><span style="color:#ff0000;">=</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Get-Cluster</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$_</span><span style="color:#000000;">}}, </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
@{N</span><span style="color:#ff0000;">=</span><span style="color:#800000;">&quot;</span><span style="color:#800000;">VMHost</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">;E</span><span style="color:#ff0000;">=</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$_</span><span style="color:#000000;">}} </span></pre>
<p>The one-liner above will return the VM name, Cluster Name and ESX Host name:<br />
  <br />&#160;<a href="http://ictfreak.files.wordpress.com/2010/01/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb1.png?w=644&#038;h=225" width="644" height="225" /></a> </p>
<p>Now you are able to document where your VMs are. But you still need to put this information somewhere. So I created a simple script which will export the information displayed above to a CSV file. The script will also remove files older than 7 days. </p>
<p>You can change the variable if you want.</p>
<pre><span style="color:#800080;">$now</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-Date</span><span style="color:#000000;">
</span><span style="color:#800080;">$days</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">7</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">C:\vCenter</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">

</span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Test-Path</span><span style="color:#000000;"> </span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;">)
{
    </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Already exists</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
}
</span><span style="color:#0000ff;">else</span><span style="color:#000000;">
{
    </span><span style="color:#5f9ea0;font-weight:bold;">New-Item</span><span style="color:#000000;"> </span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;"> -type </span><span style="color:#800000;">directory</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Created</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
}

</span><span style="color:#800080;">$lastWrite</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$now</span><span style="color:#000000;">.AddDays(</span><span style="color:#ff0000;">-</span><span style="color:#800080;">$days</span><span style="color:#000000;">)
</span><span style="color:#800080;">$files</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">get-childitem</span><span style="color:#000000;"> </span><span style="color:#800080;">$targetFolder</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-include</span><span style="color:#000000;"> *.csv </span><span style="font-style:italic;color:#5f9ea0;">-recurse</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    | </span><span style="color:#5f9ea0;font-weight:bold;">Where</span><span style="color:#000000;"> {</span><span style="color:#800080;">$_</span><span style="color:#000000;">.LastWriteTime </span><span style="color:#ff0000;">-le</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">$lastWrite</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">} 

</span><span style="color:#0000ff;">if</span><span style="color:#000000;"> ((</span><span style="color:#800080;">$files</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Measure-Object</span><span style="color:#000000;">).count </span><span style="color:#ff0000;">-gt</span><span style="color:#000000;"> </span><span style="color:#000000;">0</span><span style="color:#000000;">){
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$file</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$files</span><span style="color:#000000;">)
{</span><span style="color:#5f9ea0;font-weight:bold;">write-host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Deleting File $File</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-foregroundcolor</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Red</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">; </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Remove-Item</span><span style="color:#000000;"> </span><span style="color:#800080;">$file</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">out-null</span><span style="color:#000000;">}
}

</span><span style="color:#800080;">$filename</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">C:\vCenter\</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-Date</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-format</span><span style="color:#000000;">  </span><span style="color:#800000;">'</span><span style="color:#800000;">yyyy-MM-dd hh-mm-ss</span><span style="color:#800000;">'</span><span style="color:#000000;">) </span><span style="color:#ff0000;">+</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">.csv</span><span style="color:#800000;">'</span><span style="color:#000000;">
</span><span style="color:#800080;">$vms</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;">  </span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">DC01</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#800000;">&quot;DB</span><span style="color:#800000;">01</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">VC01</span><span style="color:#800000;">&quot; <span style="color:#000000;">| </span><span style="color:#5f9ea0;font-weight:bold;">Sort</span><span style="color:#000000;"> </span><span style="color:#800000;">Name</span><span style="color:#000000;"> </span></span><span style="color:#000000;">
</span><span style="color:#800080;">$vms</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Select</span><span style="color:#000000;"> Name, @{N</span><span style="color:#ff0000;">=</span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Cluster</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">;E</span><span style="color:#ff0000;">=</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Get-Cluster</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$_</span><span style="color:#000000;">}}, </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
@{N</span><span style="color:#ff0000;">=</span><span style="color:#800000;">&quot;</span><span style="color:#800000;">VMHost</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">;E</span><span style="color:#ff0000;">=</span><span style="color:#000000;">{</span><span style="color:#5f9ea0;font-weight:bold;">Get-VMHost</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-VM</span><span style="color:#000000;"> </span><span style="color:#800080;">$_</span><span style="color:#000000;">}} | </span><span style="color:#5f9ea0;font-weight:bold;">`</span><span style="color:#000000;">
</span><span style="color:#5f9ea0;font-weight:bold;">Export-Csv</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-NoTypeInformation</span><span style="color:#000000;"> </span><span style="color:#800080;">$filename</span></pre>
<p>The script will generate a CSV file:<br />
  <br /><a href="http://ictfreak.files.wordpress.com/2010/01/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2010/01/image_thumb2.png?w=644&#038;h=158" width="644" height="158" /></a> </p>
<p>The CSV file will look like this:</p>
<table border="1" cellspacing="0" cellpadding="2" width="311">
<tbody>
<tr>
<td valign="top" width="309">
<p>&quot;Name&quot;,&quot;Cluster&quot;,&quot;VMHost&quot;<br />
          <br />&quot;DB01&quot;,&quot;Cluster_01&quot;,&quot;esx1.ict-freak.local&quot;</p>
<p>&quot;DC01&quot;,&quot;Cluster_01&quot;,&quot;esx1.ict-freak.local&quot;</p>
<p>&quot;VC01&quot;,&quot;Cluster_01&quot;,&quot;esx1.ict-freak.local&quot;</p>
</td>
</tr>
</tbody>
</table>
<p>You can schedule this script on a VM that runs on another cluster or maybe better, schedule the script on a physical box. If you want to know how to schedule a Powershell/CLI script, go check out this post from Alan Renouf: <a title="http://www.virtu-al.net/2009/07/10/running-a-powercli-scheduled-task/" href="http://www.virtu-al.net/2009/07/10/running-a-powercli-scheduled-task/">http://www.virtu-al.net/2009/07/10/running-a-powercli-scheduled-task/</a></p>
<p>Now you are able to track the most important VMs in your environment.</p>
<br />Posted in VMware Tagged: DRS, HA, One-Liner, PowerCLI, vCenter <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4585/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4585/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4585/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4585/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4585/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4585&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2010/01/05/powercli-document-the-esx-hostname-of-the-vcenter-vm/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2010/01/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerCLI: Search VM via IP or MAC Address</title>
		<link>http://ict-freak.nl/2009/12/28/powercli-search-vm-via-ip-or-mac-address/</link>
		<comments>http://ict-freak.nl/2009/12/28/powercli-search-vm-via-ip-or-mac-address/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 07:49:04 +0000</pubDate>
		<dc:creator>afokkema</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VESI]]></category>

		<guid isPermaLink="false">http://ictfreak.wordpress.com/2009/12/28/powercli-search-vm-via-ip-or-mac-address/</guid>
		<description><![CDATA[  
In this post you’ll find two scripts that will help you find a VM via an IP or MAC address. I found the MAC address script on the vmtn communities and it was written by Luc Dekens (@LucD22):
http://communities.vmware.com/message/1068045#1068045
&#160;
IP Address:
&#160;
The following script will return the VM name after a short search. The only thing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4578&subd=ictfreak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ictfreak.files.wordpress.com/2009/12/image18.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2009/12/image_thumb18.png?w=240&#038;h=101" width="240" height="101" /></a> <a href="http://ictfreak.files.wordpress.com/2009/12/image19.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2009/12/image_thumb19.png?w=78&#038;h=66" width="78" height="66" /></a> </p>
<p>In this post you’ll find two scripts that will help you find a VM via an IP or MAC address. I found the MAC address script on the vmtn communities and it was written by Luc Dekens (@LucD22):</p>
<p><a title="http://communities.vmware.com/message/1068045#1068045" href="http://communities.vmware.com/message/1068045#1068045">http://communities.vmware.com/message/1068045#1068045</a></p>
<p>&#160;</p>
<h1>IP Address:</h1>
<p>&#160;</p>
<p>The following script will return the VM name after a short search. The only thing you need to enter is the ip address:</p>
<pre><span style="color:#800080;">$tgtIP</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">192.168.123.1</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#800080;">$vms</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;">
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$vms</span><span style="color:#000000;">){

  </span><span style="color:#800080;">$vmIP</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;">.Guest.IPAddress
  </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$ip</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$vmIP</span><span style="color:#000000;">){
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$ip</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">$tgtIP</span><span style="color:#000000;">) {
      </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Found the VM!</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
      </span><span style="color:#800080;">$vm</span><span style="color:#000000;">.Name
    }
  }
}</span></pre>
<p>When you add the script to the Virtualizaion Eco Shell, you will have to change the $tgtIP line:</p>
<pre><span style="color:#800080;">$tgtIP</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Read-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">enter IP address</span><span style="color:#800000;">&quot;</span></pre>
<p>When you run the script from the Eco Shell, you’ll have to enter an ip address:</p>
<p><a href="http://ictfreak.files.wordpress.com/2009/12/image20.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2009/12/image_thumb20.png?w=423&#038;h=141" width="423" height="141" /></a> </p>
<p>After a couple of seconds (if you have a large environment it will take a while <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) The script will return the VM name:</p>
<p><a href="http://ictfreak.files.wordpress.com/2009/12/image21.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://ictfreak.files.wordpress.com/2009/12/image_thumb21.png?w=644&#038;h=276" width="644" height="276" /></a></p>
<h1>&#160;</h1>
<h1>MAC Address</h1>
<p>&#160;</p>
<p>The following script start a search based on the MAC address of the VM. </p>
<pre><span style="color:#800080;">$tgtMAC</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;&quot;</span><span style="color:#000000;">
</span><span style="color:#800080;">$vms</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-VM</span><span style="color:#000000;">
</span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$vm</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$vms</span><span style="color:#000000;">){

  </span><span style="color:#800080;">$vmMAC</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$vm</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">Get-NetworkAdapter</span><span style="color:#000000;"> | </span><span style="color:#5f9ea0;font-weight:bold;">select</span><span style="color:#000000;"> </span><span style="color:#800000;">MacAddress</span><span style="color:#000000;">
  </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;">(</span><span style="color:#800080;">$mac</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$vmMAC</span><span style="color:#000000;">){
    </span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$mac</span><span style="color:#000000;">.MacAddress </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">$tgtMAC</span><span style="color:#000000;">) {
      </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Found the VM!</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
      </span><span style="color:#800080;">$vm</span><span style="color:#000000;">.Name
    }
  }
}</span></pre>
<p>You can also add the script to the Eco Shell. Just change the $tgtMAC line to:</p>
<pre><span style="color:#800080;">$tgtMAC</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Read-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">enter MAC address</span><span style="color:#800000;">&quot;</span></pre>
<br />Posted in VMware Tagged: PowerCLI, VESI <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ictfreak.wordpress.com/4578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ictfreak.wordpress.com/4578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ictfreak.wordpress.com/4578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ictfreak.wordpress.com/4578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ictfreak.wordpress.com/4578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ictfreak.wordpress.com/4578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ictfreak.wordpress.com/4578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ictfreak.wordpress.com/4578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ictfreak.wordpress.com/4578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ictfreak.wordpress.com/4578/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ict-freak.nl&blog=427991&post=4578&subd=ictfreak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ict-freak.nl/2009/12/28/powercli-search-vm-via-ip-or-mac-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/68a6ca0e4e1bf2d16d6db8cae5db2c7c?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">afokkema</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2009/12/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2009/12/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2009/12/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ictfreak.files.wordpress.com/2009/12/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>