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

<channel>
	<title>VCritical &#187; PowerShell</title>
	<atom:link href="http://www.vcritical.com/tag/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vcritical.com</link>
	<description>Informed Virtualization Criticism</description>
	<lastBuildDate>Wed, 19 Oct 2011 22:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Easy recovery from a full VMware ESX datastore</title>
		<link>http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/</link>
		<comments>http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 21:57:37 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[Storage VMotion]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[thin provisioning]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[VMFS]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=1757</guid>
		<description><![CDATA[With VMware vSphere, ESX, and VMFS, running out of space on a datastore does not cause damage to virtual machines.  It is easy to recover without even a guest OS reboot.]]></description>
			<content:encoded><![CDATA[<p>This is the third article in a series on VMware vSphere thin-provisioned virtual disks.  Now that we&#8217;ve covered:</p>
<ul>
<li><a href="http://www.vcritical.com/2009/10/responsible-thin-provisioning-in-vmware-vsphere/">Full accounting for all provisioned storage space and complete monitoring</a></li>
<li><a href="http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/">Automatic response to a nearly-full datastore through vCenter Alarms, PowerShell, and Storage VMotion</a></li>
</ul>
<p>You may be <em>nearly </em>convinced to start using thin provisioning, but still wondering&#8230;</p>
<h2>What happens if a datastore fills up?</h2>
<p>When a datastore runs out of space, thin-provisioned virtual disks can no longer dynamically grow to accommodate additional storage demand.  When VMware ESX detects this condition, <strong>virtual machines in need of additional storage are instantly paused</strong> to prevent guest operating systems from failing.  Conversely, VMs that that read and write to existing allocated storage blocks will continue running without issue &#8212; <strong>not all virtual machines will be paused</strong> just because a datastore is out of space.</p>
<p>If you ever find yourself in this situation, it&#8217;s not hard to fix.  Here is one simple approach, step-by-step:</p>
<ol>
<li>Free up some space by deleting or moving files &#8212; ISO images or powered-off VMs would be perfect</li>
<li>Resume one of the paused VMs</li>
<li>Use Storage VMotion to move the disks for that VM to another datastore</li>
<li>Resume the remaining VMs</li>
</ol>
<p><strong>Watch the procedure in action:</strong><br />
<embed src="http://www.youtube.com/v/4G8MEC14eKU&#038;hl=en&#038;fs=1&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></p>
<p>Depending on the size and storage demand of each VM, additional migrations may be needed.  An alternative resolution would be to add additional space to the SAN LUN and grow the VMFS volume.</p>
<p><span id="more-1757"></span></p>
<h2>The Experiment</h2>
<p>To simulate a sudden storage demand by the thin-provisioned VMs in the above video, I simply copied a large file from a network share to each Windows Server 2003 VM simultaneously.</p>
<p>For the curious, below is a PowerShell script for the task.  Run it from anywhere &#8212; it uses Sysinternals psexec to remotely initiate a file copy on each VM from a network share.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># VM naming convention combines this string with 2-digit number</span>
<span style="color: #800080;">$vmPrefix</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;VM2003e-&quot;</span>
&nbsp;
<span style="color: #008000;"># UNC path to a large file that will be copied into each VM</span>
<span style="color: #800080;">$iso</span><span style="color: pink;">=</span><span style="color: #800000;">&quot;\\fileserver\ISO\large.iso&quot;</span>
&nbsp;
<span style="color: #008000;"># credentials to download above file from \\fileserver</span>
<span style="color: #800080;">$user</span><span style="color: pink;">=</span><span style="color: #800000;">&quot;domain\username&quot;</span>
<span style="color: #800080;">$pass</span><span style="color: pink;">=</span><span style="color: #800000;">&quot;pa55word&quot;</span>
&nbsp;
<span style="color: #008000;"># pass this function a list of numbers</span>
<span style="color: #0000FF;">function</span> createVmList <span style="color: #000000;">&#40;</span><span style="color: #800080;">$series</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$vmList</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$id</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$series</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #800080;">$vmList</span> <span style="color: pink;">+=</span>  <span style="color: pink;">%</span><span style="color: #000000;">&#123;</span><span style="color: #800000;">&quot;$vmPrefix{0:00}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$id</span><span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #800080;">$vmList</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># make sure Sysinternals psexec is in your path</span>
<span style="color: #0000FF;">function</span> psexecOnVm <span style="color: #000000;">&#40;</span><span style="color: #800080;">$cmd</span><span style="color: pink;">,</span> <span style="color: #800080;">$vmList</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$vmList</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span> <span style="color: #000000;">&#123;</span><span style="color: #008080; font-weight: bold;">Invoke-Expression</span> <span style="color: #800000;">&quot;psexec.exe \\$_ -d -u $user -p $pass $cmd&quot;</span><span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
psexecOnVM <span style="color: #800000;">&quot;cmd /c copy /Y $iso c:\&quot;</span> <span style="color: #000000;">&#40;</span>createVMlist <span style="color: #000000;">&#40;</span><span style="color: #804000;">31</span>..<span style="color: #804000;">39</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<h2>VMware ESX is Resilient</h2>
<p>You may have been surprised at how easy it is to recover from a full datastore &#8212; without so much as a guest OS reboot.  It&#8217;s a testament to the rock-solid architecture behind VMware ESX and VMFS.  No other virtualization platform comes close.  Try for yourself.  See what happens if a group of thin-provisioned Hyper-V virtual machines suddenly run out of storage &#8212; it&#8217;s not going to be pretty.</p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/10/responsible-thin-provisioning-in-vmware-vsphere/' rel='bookmark' title='Responsible Thin Provisioning in VMware vSphere'>Responsible Thin Provisioning in VMware vSphere</a></li>
<li><a href='http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/' rel='bookmark' title='PowerShell Prevents Datastore Emergencies'>PowerShell Prevents Datastore Emergencies</a></li>
<li><a href='http://www.vcritical.com/2009/11/vsphere-thin-provisioned-disk-performance/' rel='bookmark' title='vSphere Thin-Provisioned Disk Performance'>vSphere Thin-Provisioned Disk Performance</a></li>
<li><a href='http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/' rel='bookmark' title='Finding thin-provisioned virtual disks with PowerShell'>Finding thin-provisioned virtual disks with PowerShell</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/pass/" rel="tag">PASS</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/storage/" rel="tag">storage</a>, <a href="http://www.vcritical.com/tag/storage-vmotion/" rel="tag">Storage VMotion</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a>, <a href="http://www.vcritical.com/tag/thin-provisioning/" rel="tag">thin provisioning</a>, <a href="http://www.vcritical.com/tag/video/" rel="tag">video</a>, <a href="http://www.vcritical.com/tag/vmfs/" rel="tag">VMFS</a>, <a href="http://www.vcritical.com/tag/vsphere/" rel="tag">vSphere</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/">Easy recovery from a full VMware ESX datastore</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>PowerShell Prevents Datastore Emergencies</title>
		<link>http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/</link>
		<comments>http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 10:30:03 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[Storage VMotion]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[thin provisioning]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=1713</guid>
		<description><![CDATA[When a datastore in your VMware vSphere environment is about to fill up, you can have vCenter automatically spring into action to prevent downtime by using Storage VMotion.]]></description>
			<content:encoded><![CDATA[<p>In my previous post on <a href="http://www.vcritical.com/2009/10/responsible-thin-provisioning-in-vmware-vsphere/">VMware vSphere thin provisioning</a>, I pointed out the new datastore alarm feature.  You can take advantage of this feature to respond to a sudden storage demand and <strong>automatically take action before end users notice</strong>.</p>
<p>When triggered, vCenter Server alarm actions allow several options, including the ability to run an arbitrary command such as a VMware PowerCLI PowerShell script.  Please see <a href="http://blogs.vmware.com/vipowershell/2009/09/how-to-run-powercli-scripts-from-vcenter-alarms.html" target="_blank">Carter Shanklin&#8217;s in-depth article</a> for more details on how this works &#8212; note that he uses a different technique to launch the scripts.</p>
<h2>Storage VMotion to the Rescue</h2>
<p>When a datastore is about to run out of space, the fastest resolution may be to simply migrate virtual disks to another datastore.   VMware Storage VMotion provides that capability with zero downtime for VMs and no disruption to end users.  Fortunately, PowerCLI can perform this feat with ease, thanks to the Move-VM cmdlet.</p>
<p>Let&#8217;s take a look at a functional prototype PowerCLI PowerShell script:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> VMware.Vimautomation.Core
Connect<span style="color: pink;">-</span>VIServer localhost
&nbsp;
<span style="color: #800080;">$vmToMove</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>vm <span style="color: pink;">-</span>Datastore <span style="color: #800080;">$env</span>:VMWARE_ALARM_TARGET_NAME <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select-object</span> <span style="color: #008080; font-style: italic;">-first</span> <span style="color: #804000;">1</span>
&nbsp;
<span style="color: #800080;">$destDS</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>Datastore <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.FreeSpaceMB <span style="color: #FF0000;">-gt</span> <span style="color: #804000;">50000</span> <span style="color: #FF0000;">-and</span> <span style="color: #000080;">$_</span>.Accessible <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$true</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select-object</span> <span style="color: #008080; font-style: italic;">-first</span> <span style="color: #804000;">1</span>
&nbsp;
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$destDS</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	move<span style="color: pink;">-</span>vm <span style="color: pink;">-</span>VM <span style="color: #800080;">$vmToMove</span> <span style="color: pink;">-</span>Datastore <span style="color: #800080;">$destDS</span> <span style="color: pink;">-</span>RunAsync
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This script is a proof-of-concept that is not ready for your production environment as it is &#8212; it just picks an arbitrary VM from the nearly-full datastore, finds another datastore with at least 50GB free, and moves the VM disks.  More comprehensive selection logic and error checking are needed for a critical task like this.<span id="more-1713"></span></p>
<p>Save your script on the vCenter Server system somewhere, such as C:\scripts\datastore.ps1.</p>
<h2>Create the Datastore Alarm</h2>
<p>Create a new alarm at an appropriate level in the vCenter hierarchy, such as a datacenter, and configure like this:</p>
<p><img class="alignnone size-full wp-image-1717" title="Datastore Alarm" src="http://www.vcritical.com/wp-content/uploads/2009/09/datastore-emergency-general.png" alt="Datastore Alarm" width="404" height="253" /></p>
<p>On the Triggers tab, add a &#8220;Datastore Disk Usage (%)&#8221; trigger to alert at a reasonable percentage &#8212; I opted for 93.</p>
<h2>Run PowerShell Directly from vCenter Server</h2>
<p>For whatever reason, PowerShell.exe does not do well when launched directly by another process &#8212; it tends to hang instead of exiting when it is finished.  As a workaround, it <em>can</em> be launched from cmd.exe as long as it receives something on standard input.  To do all that, the necessary code looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">&quot;c:\windows\system32\cmd.exe&quot; &quot;/c <span style="color: #b1b100; font-weight: bold;">echo</span>.<span style="color: #33cc33;">|</span>powershell.exe -nologo -noprofile -noninteractive c:\scripts\datastore.ps1&quot;</pre></div></div>

<p>For an alternate approach, take a look at the intermediate batch file solution described by Carter Shanklin in the link above.</p>
<p>On the Actions tab, add a &#8220;Run a command&#8221; action and supply the appropriate command.  You also need to decide whether to run one time or repeat the action.</p>
<p><a href="http://www.vcritical.com/wp-content/uploads/2009/09/datastore-emergency-run-command.png"><img class="alignnone size-medium wp-image-1718" title="Datastore alarm running a PowerShell script" src="http://www.vcritical.com/wp-content/uploads/2009/09/datastore-emergency-run-command-300x191.png" alt="Datastore alarm running a PowerShell script" width="300" height="191" /></a></p>
<h2>Action!</h2>
<p>To test the alarm, either fill up the datastore or temporarily lower the alarm threshold.  When the alarm fires, a Storage VMotion should be seen in the vSphere Client:</p>
<p><img class="alignnone size-full wp-image-1721" title="Storage VMotion in progress" src="http://www.vcritical.com/wp-content/uploads/2009/09/svmotion-inprogress.png" alt="Storage VMotion in progress" width="381" height="39" /></p>
<p>Note the &#8220;Initiated by&#8221; column &#8212; that&#8217;s the machine account for this vCenter Server.  The PowerCLI script is kicked off from vpxd.exe, which is running as LocalSystem.</p>
<p>Additional information is available by looking at the Tasks &amp; Events tab for the datastore.  Here you can see a sample sequence of events, newest on top:</p>
<p><img class="alignnone size-full wp-image-1723" title="Datastore emergency events" src="http://www.vcritical.com/wp-content/uploads/2009/09/datastore-emergency-events.png" alt="Datastore emergency events" width="500" height="418" /></p>
<h2>The Last Resort</h2>
<p>This automated Storage VMotion recovery alarm is a safety valve that could help you avoid suddenly running out of space on a datastore.  It should not take the place of more proactive storage management, but it sure beats VM downtime.</p>
<p style="padding-left: 30px;">In case you are wondering: No, you can&#8217;t do the same thing with Hyper-V because Hyper-V does not have zero-downtime Storage VMotion.  Just another reason to choose VMware vSphere &#8212; as if you needed <em>another</em> reason.</p>
<p><strong>Have you used vCenter alarms to automate any recovery processes in your environment?<br />
</strong></p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/' rel='bookmark' title='Easy recovery from a full VMware ESX datastore'>Easy recovery from a full VMware ESX datastore</a></li>
<li><a href='http://www.vcritical.com/2010/08/register-a-lun-full-of-vms-with-powercli/' rel='bookmark' title='Register a LUN full of VMs with PowerCLI'>Register a LUN full of VMs with PowerCLI</a></li>
<li><a href='http://www.vcritical.com/2009/10/responsible-thin-provisioning-in-vmware-vsphere/' rel='bookmark' title='Responsible Thin Provisioning in VMware vSphere'>Responsible Thin Provisioning in VMware vSphere</a></li>
<li><a href='http://www.vcritical.com/2009/06/vmware-vsphere-4-has-a-snapshot-alarm/' rel='bookmark' title='VMware vSphere 4 has a Snapshot Alarm'>VMware vSphere 4 has a Snapshot Alarm</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/pass/" rel="tag">PASS</a>, <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/storage/" rel="tag">storage</a>, <a href="http://www.vcritical.com/tag/storage-vmotion/" rel="tag">Storage VMotion</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a>, <a href="http://www.vcritical.com/tag/thin-provisioning/" rel="tag">thin provisioning</a>, <a href="http://www.vcritical.com/tag/vcenter/" rel="tag">vCenter</a>, <a href="http://www.vcritical.com/tag/vsphere/" rel="tag">vSphere</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/">PowerShell Prevents Datastore Emergencies</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>IGT Part 6: Cluster invari-what ID?</title>
		<link>http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/</link>
		<comments>http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:22:18 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[IGT]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCVMM]]></category>
		<category><![CDATA[vCenter]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=913</guid>
		<description><![CDATA[SCVMM adds a custom attribute to VirtualCenter (vCenter).]]></description>
			<content:encoded><![CDATA[<p><em>This article is part of a series on <a href="http://www.vcritical.com/2008/12/incoming-google-traffic-introduction/">Incoming Google Traffic</a> (IGT).</em></p>
<p>There are still lots of folks trying to figure out why their VMware vCenter virtual machines are all polluted with a new custom attribute called <strong>clusterinvariantvmmid</strong>.  I know this because of the steady flow of incoming Google traffic with this keyword.  It&#8217;s kind of odd&#8211;Google for that term and you will get about four results, the top two being TechNet Forums and VCritical.  I would have thought that by now Microsoft would have formally documented this aspect of the vCenter/SCVMM integration, but evidently they have not.</p>
<p>Not to worry.  If you have landed here after searching Google for custerinvariantvmmid, the VCritical article on <a href="http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/">how to clean up after SCVMM leaves</a> is still as applicable as ever&#8211;and it&#8217;s all automated with PowerShell.  <a href="http://edge.networkworld.com/community/node/36896" target="_blank">Some say ironic</a>.  I say use the best tool for the job.</p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/09/igt-part-7-virtual-vmware-esx-4-in-high-demand/' rel='bookmark' title='IGT Part 7: Virtual VMware ESX 4 in high demand'>IGT Part 7: Virtual VMware ESX 4 in high demand</a></li>
<li><a href='http://www.vcritical.com/2009/01/igt-part-5-hyper-v-snapshots-are-not-gone-until-the-vm-is-powered-off/' rel='bookmark' title='IGT Part 5:  Hyper-V snapshots are not gone until the VM is powered off'>IGT Part 5:  Hyper-V snapshots are not gone until the VM is powered off</a></li>
<li><a href='http://www.vcritical.com/2008/12/igt-part-3-one-vm-per-lun-doubters/' rel='bookmark' title='IGT Part 3: One-VM-per-LUN doubters'>IGT Part 3: One-VM-per-LUN doubters</a></li>
<li><a href='http://www.vcritical.com/2008/12/igt-part-4-failover-frustration/' rel='bookmark' title='IGT Part 4: Failover frustration'>IGT Part 4: Failover frustration</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/igt/" rel="tag">IGT</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/scvmm/" rel="tag">SCVMM</a>, <a href="http://www.vcritical.com/tag/vcenter/" rel="tag">vCenter</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/">IGT Part 6: Cluster invari-what ID?</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better console for PowerShell and VITK</title>
		<link>http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/</link>
		<comments>http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 11:00:37 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=584</guid>
		<description><![CDATA[By using Console2 with PowerShell and the VI Toolkit, users have much better text manipulation capabilities as well as the option to use different fonts.]]></description>
			<content:encoded><![CDATA[<p>The stock Windows command prompt (cmd.exe) is pretty limited&#8211;if you want to use <a href="http://www.vcritical.com/2009/01/get-a-better-font-for-putty/">a better font</a> or copy text in lines instead of clunky rectangular blocks, you need something else.  For Windows command-line utilities, PowerShell, and the VI Toolkit (for Windows), I have been using the open-source <a href="http://sourceforge.net/projects/console/">Console2</a> with much satisfaction.  The tabbed interface is pretty cool:</p>
<p><img class="alignnone size-full wp-image-657" title="Console2 with VI Toolkit and PowerShell tabs." src="http://www.vcritical.com/wp-content/uploads/2009/02/console2-vitk-ps.gif" alt="Console2 with VI Toolkit and PowerShell tabs." width="500" height="280" /></p>
<p>If that looks interesting, here is what you do:<span id="more-584"></span></p>
<ul>
<li>Download <a href="http://sourceforge.net/projects/console/" target="_blank">Console2</a> (current version is 2.00 Beta, build 142); extract on your system somewhere</li>
<li>Grab <a href="http://www.vcritical.com/wp-content/uploads/2009/02/console2-vcritical-2009-02-04.zip">this file</a> with icons and a replacement configuration file (console.xml); extract into the same location</li>
<li>Make a shortcut to console.exe
<ul>
<li>Multiple tabs can be opened during launch by adding -t to your shortcut target (e.g., -t Console2 -t &#8220;VI Toolkit&#8221;)</li>
</ul>
</li>
<li>Optional: <a href="http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/">fix your prompts</a></li>
</ul>
<p>My configuration file has a few changes to the mouse behavior:</p>
<ul>
<li>Left &#8211; select + copy automatically</li>
<li>Right &#8211; paste</li>
<li>Middle &#8211; pop-up menu</li>
</ul>
<p>If you prefer to not use my entire configuration file, just copy the applicable portions from the &lt;tabs&gt; element.</p>
<p>I hope you  have enjoyed this slight diversion from the regular VCritical programming lineup.  Thanks for reading.</p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/' rel='bookmark' title='VI Toolkit (for Windows) 1.5 and the PowerShell prompt'>VI Toolkit (for Windows) 1.5 and the PowerShell prompt</a></li>
<li><a href='http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/' rel='bookmark' title='PowerShell Prevents Datastore Emergencies'>PowerShell Prevents Datastore Emergencies</a></li>
<li><a href='http://www.vcritical.com/2008/11/automating-vi-client-login/' rel='bookmark' title='Automating VI Client login'>Automating VI Client login</a></li>
<li><a href='http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/' rel='bookmark' title='VI Toolkit (for Windows) 1.5 released'>VI Toolkit (for Windows) 1.5 released</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/">Better console for PowerShell and VITK</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>VI Toolkit (for Windows) 1.5 and the PowerShell prompt</title>
		<link>http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/</link>
		<comments>http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 14:50:01 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=604</guid>
		<description><![CDATA[The VI Toolkit for Windows overrides an existing PowerShell prompt function.  Here is one simple way to restore a desired setting.]]></description>
			<content:encoded><![CDATA[<p>One of the first things that I noticed after launching my VI Toolkit (for Windows) 1.5 is the new prompt.  It&#8217;s tricked-out with color now, but unfortunately steps on the existing two-row PowerShell prompt I had configured on my system &#8212; which was working fine with VITK 1.0.</p>
<p>I tend to use a two-row prompt in all of my shells (cmd.exe, Bash, PowerShell) because long commands get confusing when they wrap to another line.  Some people think this is a terrible idea &#8212; if you are one of them, feel free to stop reading right now.</p>
<p>Here is the default VITK 1.5 console, along with a typical command:</p>
<p style="text-align: center;"><a href="http://www.vcritical.com/wp-content/uploads/2009/01/2-row-command.png"><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-606" title="Command wrapping onto another line." src="http://www.vcritical.com/wp-content/uploads/2009/01/2-row-command.png" alt="Command wrapping onto another line." width="468" height="237" /></a></p>
<p>You can see the customization added by VITK 1.5. Note that VITK 1.0 did not specify a prompt at all &#8212; it simply used whatever PowerShell was configured to use.  The PowerShell prompt can be configured in a variety of ways, one of which is to create the file: <span style="font-family: monospace; font-weight: bold; font-size: 10pt;">&#8230;\My Documents\WindowsPowerShell\profile.ps1</span> containing:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">function</span> global:prompt <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">get-location</span><span style="color: #000000;">&#41;</span>.path <span style="color: pink;">+</span> <span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&gt;;&quot;</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p>That stopped working because VITK 1.5 now specifically defines a prompt function in <span style="font-family: monospace; font-weight: bold; font-size: 10pt;">C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1</span><br />
<span id="more-604"></span><br />
To get a two-row prompt, simply open that file and add <span style="font-family: monospace; font-weight: bold; font-size: 10pt;">`n</span> (that symbol is a backtick &#8212; above the Tab key on most keyboards) right before the <span style="font-family: monospace; font-weight: bold; font-size: 10pt;">&gt;</span> on line 81 (the last line shown in the snippet below):</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># change prompt text</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;[&quot;</span> <span style="color: #008080; font-style: italic;">-NoNewLine</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;VI Toolkit&quot;</span> <span style="color: #008080; font-style: italic;">-NoNewLine</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Green
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;] &quot;</span> <span style="color: #008080; font-style: italic;">-NoNewLine</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-location</span><span style="color: #000000;">&#41;</span>.Path <span style="color: pink;">+</span> <span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&gt;&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">-NoNewLine</span></pre></div></div>

<p>You will end up with this:</p>
<p style="text-align: center;"><a href="http://www.vcritical.com/wp-content/uploads/2009/01/2-row.png"><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-605" title="Two-row prompt with long command." src="http://www.vcritical.com/wp-content/uploads/2009/01/2-row.png" alt="Two-row prompt with long command." width="468" height="237" /></a></p>
<p>I don&#8217;t think this change causes any harm to the VITK installation &#8212; please correct me if I&#8217;m wrong.</p>
<p><strong>In related news&#8230;</strong><br />
A quick way to set up the standard Windows Command Prompt with two rows is to just load this .reg file:</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;"><span style="color: #0000FF;">Windows Registry Editor Version 5.00</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_LOCAL_MACHINE</span>\SYSTEM\CurrentControlSet\Control\Session Manager\Environment<span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">&quot;PROMPT&quot;</span><span style="color: #000000;">=</span><span style="">&quot;$P\\$_$G&quot;</span></pre></div></div>



<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/' rel='bookmark' title='Better console for PowerShell and VITK'>Better console for PowerShell and VITK</a></li>
<li><a href='http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/' rel='bookmark' title='Finding thin-provisioned virtual disks with PowerShell'>Finding thin-provisioned virtual disks with PowerShell</a></li>
<li><a href='http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/' rel='bookmark' title='VI Toolkit (for Windows) 1.5 released'>VI Toolkit (for Windows) 1.5 released</a></li>
<li><a href='http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/' rel='bookmark' title='Clean up vCenter with PowerShell after SCVMM leaves'>Clean up vCenter with PowerShell after SCVMM leaves</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/">VI Toolkit (for Windows) 1.5 and the PowerShell prompt</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/02/vi-toolkit-for-windows-15-and-the-powershell-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCVMM 2008 Management Pack Finally Released</title>
		<link>http://www.vcritical.com/2009/01/scvmm-2008-management-pack-finally-released/</link>
		<comments>http://www.vcritical.com/2009/01/scvmm-2008-management-pack-finally-released/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 20:52:21 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCOM]]></category>
		<category><![CDATA[SCVMM]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=597</guid>
		<description><![CDATA[The System Center Operations Manager Management Pack (MP) for System Center Virtual Machine Manager 2008 was finally released yesterday.  As I wrote previously, the documentation was initially misleading on this feature &#8212; eventually we learned that the MP would ship 60 days after SCVMM 2008 released. Let&#8217;s use PowerShell to find out if Microsoft made [...]]]></description>
			<content:encoded><![CDATA[<p>The System Center Operations Manager Management Pack (MP) for System Center Virtual Machine Manager 2008 <a href="http://blogs.technet.com/rakeshm/archive/2009/01/28/updated-management-pack-for-scvmm-2008-now-available.aspx" target="_blank">was finally released yesterday</a>.  As I <a href="http://www.vcritical.com/2008/11/misleading-documentation-or-none-at-all-ill-take-the-latter-thanks/">wrote previously</a>, the documentation was initially misleading on this feature &#8212; eventually we learned that the MP would ship <strong>60 days</strong> after SCVMM 2008 released.</p>
<p>Let&#8217;s use PowerShell to find out if Microsoft made their release date:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$RtmDate</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #800000;">&quot;October 21, 2008&quot;</span>
<span style="color: #800080;">$MgtPackReleaseDate</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #800000;">&quot;January 28, 2009&quot;</span>
<span style="color: #800080;">$MgtPackDueDate</span> <span style="color: pink;">=</span> <span style="color: #800080;">$RtmDate</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: #804000;">60</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$DaysTaken</span> <span style="color: pink;">=</span> <span style="color: #800080;">$MgtPackReleaseDate</span>.Subtract<span style="color: #000000;">&#40;</span><span style="color: #800080;">$RtmDate</span><span style="color: #000000;">&#41;</span>.Days
<span style="color: #800080;">$DaysLate</span> <span style="color: pink;">=</span> <span style="color: #800080;">$MgtPackReleaseDate</span>.Subtract<span style="color: #000000;">&#40;</span><span style="color: #800080;">$MgtPackDueDate</span><span style="color: #000000;">&#41;</span>.Days
&nbsp;
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Due date:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span> <span style="color: #800080;">$MgtPackDueDate</span>.ToShortDateString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Release date:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span> <span style="color: #800080;">$MgtPackReleaseDate</span>.ToShortDateString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Days taken:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span> <span style="color: #800080;">$DaysTaken</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Days late:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span> $DaysLate</pre></div></div>

<p>Results:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Due date:        12/20/2008
Release date:    1/28/2009
Days taken:      99
Days late:       39</pre></div></div>



<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/07/wild-scvmm-2008-r2-rumors-and-speculation/' rel='bookmark' title='Wild SCVMM 2008 R2 rumors and speculation'>Wild SCVMM 2008 R2 rumors and speculation</a></li>
<li><a href='http://www.vcritical.com/2009/08/hello-scvmm-2008-r2/' rel='bookmark' title='Hello, SCVMM 2008 R2'>Hello, SCVMM 2008 R2</a></li>
<li><a href='http://www.vcritical.com/2008/11/misleading-documentation-or-none-at-all-ill-take-the-latter-thanks/' rel='bookmark' title='Misleading documentation or none at all?  I&#8217;ll take the latter, thanks.'>Misleading documentation or none at all?  I&#8217;ll take the latter, thanks.</a></li>
<li><a href='http://www.vcritical.com/2009/08/is-scvmm-2008-r2-really-banned-from-vmworld/' rel='bookmark' title='Is SCVMM 2008 R2 really banned from VMworld?'>Is SCVMM 2008 R2 really banned from VMworld?</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/01/scvmm-2008-management-pack-finally-released/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/scom/" rel="tag">SCOM</a>, <a href="http://www.vcritical.com/tag/scvmm/" rel="tag">SCVMM</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/01/scvmm-2008-management-pack-finally-released/">SCVMM 2008 Management Pack Finally Released</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/01/scvmm-2008-management-pack-finally-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VI Toolkit (for Windows) 1.5 released</title>
		<link>http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/</link>
		<comments>http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 19:08:40 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=586</guid>
		<description><![CDATA[There is a new version of the VI Toolkit (for Windows) up for the taking now, with quite a few new cmdlets and fixes.  Visit the official blog for links to download and read the release notes.  I installed the upgrade on top of my existing 1.0 without any issues.  (Wow, the download now weighs [...]]]></description>
			<content:encoded><![CDATA[<p>There is a new version of the VI Toolkit (for Windows) up for the taking now, with quite a few new cmdlets and fixes.  Visit the <a href="http://blogs.vmware.com/vipowershell/2009/01/vi-toolkit-15-released.html">official blog</a> for links to download and read the release notes.  I installed the upgrade on top of my existing 1.0 without any issues.  (Wow, the download now weighs in at 41MB.)</p>
<p>After launching the new version I noticed a couple of really nice additions right away.  Two new helpful commands:</p>
<p><strong>Get-VIToolkitDocumentation</strong> will pop open the local help file</p>
<p><strong>Get-VIToolkitCommunity</strong> launches your web browser to the <a href="http://communities.vmware.com/community/developer/windows_toolkit">official Community site</a></p>
<p>Carter Shanklin also posted a <a href="http://www.vimeo.com/videos/search:vi-toolkit%2015-release" target="_blank">series of videos</a> on Vimeo.  I was glad to hear about the fixes to <strong>Move-VM</strong>:</p>
<object type="application/x-shockwave-flash" style="width:448px;height:386px" data="http://www.vimeo.com/moogaloop.swf?clip_id=2985147&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2985147&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" />If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash Player</a> from Adobe.</object><br/>
		<!-- Valid XHTML flash object delivered by XHTML Video Embed. Get it at: http://saltwaterc.net/xhtml-video-embed -->
		


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/02/better-console-for-powershell-and-vitk/' rel='bookmark' title='Better console for PowerShell and VITK'>Better console for PowerShell and VITK</a></li>
<li><a href='http://www.vcritical.com/2010/01/vmware-esxi-4-sd-flash-in-bl460c-g6/' rel='bookmark' title='VMware ESXi 4: SD Flash in BL460c G6'>VMware ESXi 4: SD Flash in BL460c G6</a></li>
<li><a href='http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/' rel='bookmark' title='Clean up vCenter with PowerShell after SCVMM leaves'>Clean up vCenter with PowerShell after SCVMM leaves</a></li>
<li><a href='http://www.vcritical.com/2009/07/upgrading-vms-to-vsphere-virtual-hardware/' rel='bookmark' title='Upgrading VMs to vSphere virtual hardware'>Upgrading VMs to vSphere virtual hardware</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/">VI Toolkit (for Windows) 1.5 released</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/01/vi-toolkit-for-windows-15-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Which guest operating systems can be customized by SCVMM?</title>
		<link>http://www.vcritical.com/2009/01/which-guest-operating-systems-can-be-customized-by-scvmm/</link>
		<comments>http://www.vcritical.com/2009/01/which-guest-operating-systems-can-be-customized-by-scvmm/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 16:22:52 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCVMM]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=506</guid>
		<description><![CDATA[Although SLES 10 is supposedly supported by SCVMM 2008, administrators must look elsewhere for a Linux guest customization solution.]]></description>
			<content:encoded><![CDATA[<p>A crucial virtualization management feature is the ability to easily configure a new virtual machine&#8217;s identity as it is provisioned from a template.  This is commonly known as guest operating system customization.</p>
<p>I was poking around with the System Center Virtual Machine Manager 2008 (SCVMM) PowerShell functionality and came across an interesting cmdlet that can be used to reveal which guest operating systems are customizable:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> C:\Windows\System32<span style="color: pink;">&gt;</span> Get<span style="color: pink;">-</span>OperatingSystem <span style="color: pink;">|</span>
<span style="color: pink;">&gt;&gt;</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.IsCustomizationAllowed <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$true</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">sort</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">ft</span> Name</pre></div></div>

<p>Which yields the following list:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Name
----
64-bit edition of Windows Server 2008 Datacenter
64-bit edition of Windows Server 2008 Enterprise
64-bit edition of Windows Server 2008 Standard
64-bit edition of Windows Vista
Windows 2000 Advanced Server
Windows 2000 Server
Windows Server 2003 Datacenter Edition (32-bit x86)
Windows Server 2003 Datacenter x64 Edition
Windows Server 2003 Enterprise Edition (32-bit x86)
Windows Server 2003 Enterprise x64 Edition
Windows Server 2003 Standard Edition (32-bit x86)
Windows Server 2003 Standard x64 Edition
Windows Server 2003 Web Edition
Windows Server 2008 Datacenter 32-Bit
Windows Server 2008 Enterprise 32-Bit
Windows Server 2008 Standard 32-Bit
Windows Small Business Server 2003
Windows Vista
Windows Web Server 2008
Windows XP 64-Bit Edition
Windows XP Professional</pre></div></div>

<p>Interesting.  No Linux?  I thought SCVMM and Hyper-V were embracing at least one Linux distribution.  Let&#8217;s try the converse of that command:<span id="more-506"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">PS</span> C:\Windows\System32<span style="color: pink;">&gt;</span> Get<span style="color: pink;">-</span>OperatingSystem <span style="color: pink;">|</span>
<span style="color: pink;">&gt;&gt;</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.IsCustomizationAllowed <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$false</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">sort</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">ft</span> Name</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Name
----
None
Novell NetWare 5.1
Novell NetWare 6.x
Open Enterprise Server
Other (32 bit)
Other (64 bit)
Other Linux (32 bit)
Other Linux (64 bit)
Red Hat Enterprise Linux 2
Red Hat Enterprise Linux 3
Red Hat Enterprise Linux 3 (64 bit)
Red Hat Enterprise Linux 4
Red Hat Enterprise Linux 4 (64 bit)
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 5 (64 bit)
Sun Solaris 10 (32 bit)
Sun Solaris 10 (64 bit)
Suse Linux Enterprise Server 10 (32 bit)
Suse Linux Enterprise Server 10 (64 bit)
Suse Linux Enterprise Server 9 (32 bit)
Suse Linux Enterprise Server 9 (64 bit)
Ubuntu Linux (32 bit)
Ubuntu Linux (64 bit)
Windows NT Server 4.0</pre></div></div>

<p>Whoa!  Why is SLES 10 is on that list?  That is a <a href="http://www.microsoft.com/windowsserver2008/en/us/hyperv-supported-guest-os.aspx" target="_blank">supported guest OS</a>.</p>
<p><strong>Sometimes supported doesn&#8217;t mean fully functional. </strong>For a virtualization platform that treats Linux workloads like first-class citizens, choose VMware ESX with vCenter Server:</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-546" title="VMware vCenter Guest Customization Wizard" src="http://www.vcritical.com/wp-content/uploads/2009/01/linux-customize.png" alt="VMware vCenter Guest Customization Wizard" width="312" height="135" /></p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/02/hyper-v-linux-smokescreen/' rel='bookmark' title='Hyper-V Linux Smokescreen'>Hyper-V Linux Smokescreen</a></li>
<li><a href='http://www.vcritical.com/2010/04/what-is-red-hat-enterprise-virtualization/' rel='bookmark' title='What is Red Hat Enterprise Virtualization?'>What is Red Hat Enterprise Virtualization?</a></li>
<li><a href='http://www.vcritical.com/2010/04/rhev-manager-its-not-just-a-clever-name/' rel='bookmark' title='RHEV Manager &#8212; It&#8217;s not just a clever name'>RHEV Manager &#8212; It&#8217;s not just a clever name</a></li>
<li><a href='http://www.vcritical.com/2010/04/dear-red-hat/' rel='bookmark' title='Dear Red Hat&#8230;'>Dear Red Hat&#8230;</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/01/which-guest-operating-systems-can-be-customized-by-scvmm/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/customization/" rel="tag">customization</a>, <a href="http://www.vcritical.com/tag/hyper-v/" rel="tag">Hyper-V</a>, <a href="http://www.vcritical.com/tag/linux/" rel="tag">Linux</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/scvmm/" rel="tag">SCVMM</a>, <a href="http://www.vcritical.com/tag/templates/" rel="tag">templates</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/01/which-guest-operating-systems-can-be-customized-by-scvmm/">Which guest operating systems can be customized by SCVMM?</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/01/which-guest-operating-systems-can-be-customized-by-scvmm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding thin-provisioned virtual disks with PowerShell</title>
		<link>http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/</link>
		<comments>http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 18:26:39 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[ESX]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[VI Client]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=514</guid>
		<description><![CDATA[Even though the VI Client does not offer creation of VMs with thin-provisioned disks, they may exist.  Use a PowerShell script to identify them.]]></description>
			<content:encoded><![CDATA[<p>By default, all virtual hard disks in VI3 are <strong>thick disks</strong> &#8212; space is allocated on the VMFS datastore for the entire disk.  <strong>Thin disks</strong>, on the other hand, grow dynamically according to guest OS demand.  There is a slight performance penalty with thin disks, but the real risk when using them is inadvertently filling up datastores after overcommitting storage resources.</p>
<p>The VI Client interface will not let administrators create new virtual machines with thin-provisioned disks.  Even so, it is entirely possible that your environment contains such disks.  Let&#8217;s take a look at a couple of ways to create these disks and then use a VI Toolkit (for Windows) PowerShell script to see if any exist.<span id="more-514"></span></p>
<h2>Manual VMDK Creation</h2>
<p>One way that thin disks may be introduced into an environment is by manually creating a VMDK file and then attaching that file to a virtual machine.  This can be accomplished by the vmkfstools command with the -d thin option.  This procedure is not for beginners, so if you have used it you presumably evaluated the risks of overcommitting your storage.  But what if one of your colleagues did this without telling you?</p>
<h2>Compact Clones</h2>
<p><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  class="alignleft size-full wp-image-515" title="VI Client - Clone to template" src="http://www.vcritical.com/wp-content/uploads/2009/01/clone-to-template-menu.png" alt="VI Client - Clone to template" width="181" height="207" />Another source of thin disks requires a little background first:</p>
<p>There is a prominent option in the VI Client interface to convert a virtual machine to template (and vice versa).  But if you right-click a VM in the inventory, you are presented with a variation of that feature:  <strong>Clone to Template</strong>.</p>
<p>The wizard that launches in response to that option allows an administrator to optionally choose the <strong>Compact</strong> disk format &#8212; this is a thin-provisioned disk.  If your template has a 50GB virtual disk but only 8GB are actually used, this feature can provide significant storage savings.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-516" style="border: 1px solid black;;  display: block; margin-right: auto; margin-left: auto;" title="Clone to Template Wizard - Compact disk" src="http://www.vcritical.com/wp-content/uploads/2009/01/wizard-compact.png" alt="Clone to Template Wizard - Compact disk" width="499" height="347" /></p>
<p>So far so good.  Now, what do you suppose happens if you decide to convert that template to a VM?  Nothing happens &#8212; it just works.  You are free to use that VM just like any other in your inventory.  But this VM keeps its thin-provisioned disk, a fact that is not discernible through the user interface.</p>
<h2>Find the Thin-Provisioned Disks</h2>
<p>I wrote a small VI Toolkit (for Windows) PowerShell script that identifies latent thin disks in both VMs and templates.  I hope you find it useful:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># FindThinDisks.ps1</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;"># Identifies VMs and templates that are using thin-provisioned</span>
<span style="color: #008000;"># virtual disks.</span>
&nbsp;
<span style="color: #008000;"># Version 1.0  January 14, 2009</span>
<span style="color: #008000;"># Eric Gray</span>
&nbsp;
<span style="color: #800080;">$vmtp</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>VM
<span style="color: #800080;">$vmtp</span> <span style="color: pink;">+=</span> Get<span style="color: pink;">-</span>Template
&nbsp;
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$vm</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$vmtp</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>View<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
  <span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$dev</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$vm</span>.Config.Hardware.Device<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$dev</span>.GetType<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.Name <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;VirtualDisk&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
      <span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$dev</span>.Backing.ThinProvisioned <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #800080;">$vm</span>.Name <span style="color: pink;">+</span> <span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$dev</span>.Backing.FileName
      <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p style="text-align: left;">Thin-provisioning is a great tool to have in your toolbox, when used properly.</p>
<p style="text-align: right;"><em>Script inspired by <a href="http://communities.vmware.com/message/1136794" target="_blank">this thread</a>.</em></p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/11/vsphere-thin-provisioned-disk-performance/' rel='bookmark' title='vSphere Thin-Provisioned Disk Performance'>vSphere Thin-Provisioned Disk Performance</a></li>
<li><a href='http://www.vcritical.com/2009/10/responsible-thin-provisioning-in-vmware-vsphere/' rel='bookmark' title='Responsible Thin Provisioning in VMware vSphere'>Responsible Thin Provisioning in VMware vSphere</a></li>
<li><a href='http://www.vcritical.com/2009/10/easy-recovery-from-a-full-vmware-esx-datastore/' rel='bookmark' title='Easy recovery from a full VMware ESX datastore'>Easy recovery from a full VMware ESX datastore</a></li>
<li><a href='http://www.vcritical.com/2009/10/powershell-prevents-datastore-emergencies/' rel='bookmark' title='PowerShell Prevents Datastore Emergencies'>PowerShell Prevents Datastore Emergencies</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/esx/" rel="tag">ESX</a>, <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/storage/" rel="tag">storage</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a>, <a href="http://www.vcritical.com/tag/templates/" rel="tag">templates</a>, <a href="http://www.vcritical.com/tag/vcenter/" rel="tag">vCenter</a>, <a href="http://www.vcritical.com/tag/vi-client/" rel="tag">VI Client</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/">Finding thin-provisioned virtual disks with PowerShell</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/01/finding-thin-provisioned-virtual-disks-with-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Clean up vCenter with PowerShell after SCVMM leaves</title>
		<link>http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/</link>
		<comments>http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 21:16:01 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCVMM]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[vCenter]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=432</guid>
		<description><![CDATA[When System Center Virtual Machine Manager (SCVMM) connects to VirtualCenter/vCenter, several changes are made.  Learn how to recover everything with PowerShell.]]></description>
			<content:encoded><![CDATA[<p>Microsoft System Center Virtual Machine Manager (SCVMM) 2008 makes several changes to your vCenter environment that you may like to know about, especially since they don&#8217;t seem to be mentioned in the product documentation.  It&#8217;s also worth pointing out that none of these changes are reverted when you subsequently decide to discontinue managing vCenter with SCVMM.</p>
<p>There are three different affected areas and you can fix each one manually or all in one shot with a VI Toolkit (for Windows) PowerShell script that I wrote for just this purpose.</p>
<h2>1.  SCVMM Port Groups</h2>
<p><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  class="size-full wp-image-436 alignleft" title="VI Client displaying several SCVMM-created networks" src="http://www.vcritical.com/wp-content/uploads/2008/12/networks-scvmm.png" alt="networks-scvmm" width="203" height="205" /></p>
<p>First, let&#8217;s address the new port groups that SCVMM created when managing your VMware ESX VMs.  I covered this in more detail in a <a href="http://www.vcritical.com/2008/12/thanks-for-all-the-port-groups/">previous article</a>.  Essentially, the SCVMM interface presents vSwitches, not port groups.  It then creates one or more new port groups for you without warning &#8212; one per vSwitch, per VLAN, on each ESX host.</p>
<p>To recover from this mess, you will need to reconfigure any VMs that are currently using these port groups and then delete the port groups from the vSwitches.  If you have more than a couple VMs this task will be easier with the script.<span id="more-432"></span></p>
<h2 style="clear:both">2.  Custom Attribute: ClusterInvariantVMMId</h2>
<p>I bet you did not know that SCVMM would add a new strangely-named custom attribute to vCenter and tag every single VM in your inventory with a GUID.  I&#8217;ve heard puzzled VMware customers asking about this.  Initially, the explanation for this phenomenon was not clear &#8212; until I evaluated the SCVMM product and VMware vCenter integration.  If you are done with SCVMM, it is safe to remove this attribute with VI Client (on the Administration menu).</p>
<p><img class="size-full wp-image-435 alignnone" style="border: 1px solid black;" title="VM Annotation field displaying ClusterInvariantVMMID" src="http://www.vcritical.com/wp-content/uploads/2008/12/annotations.png" alt="annotations" width="433" height="243" /></p>
<h2>3.  Self-Service Role</h2>
<p>Evidently the Self-Service Portal feature of SCVMM will allow users to provision and manage VMs on ESX hosts in addition to Hyper-V.  I tried this and it did not work, but I probably wasn&#8217;t persistent enough.  When you are done using SCVMM you won&#8217;t be needing that role anymore &#8212; go ahead and delete it.</p>
<p><img class="alignnone size-full wp-image-433" title="roles" src="http://www.vcritical.com/wp-content/uploads/2008/12/roles.png" alt="roles" width="442" height="265" /></p>
<h2>PowerShell Cleanup Script</h2>
<p>If you would like to clean up all three of these issues in one step, use the following VI Toolkit (for Windows):</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># SCVMM-Cleanup.ps1</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;"># When SCVMM connects to vCenter, it makes several changes and doesn't clean up</span>
<span style="color: #008000;"># after itself.  This script returns everything back to normal.</span>
&nbsp;
<span style="color: #008000;"># Version 1.0  January 5, 2009</span>
<span style="color: #008000;"># Eric Gray</span>
&nbsp;
<span style="color: #008000;"># modify this line accordingly</span>
Get<span style="color: pink;">-</span>VC vchostname <span style="color: pink;">-</span>user xxx <span style="color: pink;">-</span>Password yyy
&nbsp;
<span style="color: #008000;"># VMs using SCVMM-created port groups will be reconfigured to use this instead</span>
<span style="color: #800080;">$portGroup</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;VM Network&quot;</span>
&nbsp;
<span style="color: #008000;"># Move all NICs from the SCVMM.vSwitchX.Y port groups to $portGroup</span>
get<span style="color: pink;">-</span>vm <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>NetworkAdapter <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.NetworkName <span style="color: #FF0000;">-like</span> <span style="color: #800000;">&quot;SCVMM*&quot;</span><span style="color: #000000;">&#125;</span> `
    <span style="color: pink;">|</span> Set<span style="color: pink;">-</span>NetworkAdapter <span style="color: pink;">-</span>NetworkName <span style="color: #800080;">$portGroup</span> <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$false</span>
&nbsp;
<span style="color: #008000;"># Delete those SCVMM port groups after they are no longer in use</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$esx</span> <span style="color: #0000FF;">in</span> Get<span style="color: pink;">-</span>VMHost<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    Get<span style="color: pink;">-</span>VirtualPortGroup <span style="color: pink;">-</span>VMHost <span style="color: #800080;">$esx</span>.Name <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.Name <span style="color: #FF0000;">-like</span> <span style="color: #800000;">&quot;SCVMM*&quot;</span> <span style="color: #000000;">&#125;</span> `
    <span style="color: pink;">|</span> Remove<span style="color: pink;">-</span>VirtualPortGroup  <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$false</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Clean up the custom attribute</span>
Get<span style="color: pink;">-</span>Datacenter <span style="color: pink;">|</span> Remove<span style="color: pink;">-</span>CustomField <span style="color: #008080; font-style: italic;">-Name</span> ClusterInvariantVMMId <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$false</span>
&nbsp;
<span style="color: #008000;"># Remove the SCVMM role</span>
<span style="color: #800080;">$authMgr</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>View AuthorizationManager
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$role</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$authMgr</span>.RoleList <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Name <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;SCVMMSelfServiceUser&quot;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$authMgr</span>.RemoveAuthorizationRole<span style="color: #000000;">&#40;</span><span style="color: #800080;">$role</span>.roleid<span style="color: pink;">,</span> <span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>If you or one of your coworkers accidentally polluted your vCenter environment, this should help you get everything back in order.</p>
<p style="text-align: right;"><em>Thanks go to Carter Shanklin for reviewing the script.</em></p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2009/04/igt-part-6-cluster-invari-what-id/' rel='bookmark' title='IGT Part 6: Cluster invari-what ID?'>IGT Part 6: Cluster invari-what ID?</a></li>
<li><a href='http://www.vcritical.com/2009/03/managing-vi3-with-scvmm-considered-harmful/' rel='bookmark' title='Managing VI3 with SCVMM considered harmful'>Managing VI3 with SCVMM considered harmful</a></li>
<li><a href='http://www.vcritical.com/2008/12/thanks-for-all-the-port-groups/' rel='bookmark' title='Thanks for all the port groups!'>Thanks for all the port groups!</a></li>
<li><a href='http://www.vcritical.com/2009/04/vmware-vcenter-server-4-task-and-event-retention/' rel='bookmark' title='VMware vCenter Server 4 task and event retention'>VMware vCenter Server 4 task and event retention</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/networking/" rel="tag">networking</a>, <a href="http://www.vcritical.com/tag/powercli/" rel="tag">PowerCLI</a>, <a href="http://www.vcritical.com/tag/powershell/" rel="tag">PowerShell</a>, <a href="http://www.vcritical.com/tag/scvmm/" rel="tag">SCVMM</a>, <a href="http://www.vcritical.com/tag/technical/" rel="tag">Technical</a>, <a href="http://www.vcritical.com/tag/vcenter/" rel="tag">vCenter</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/">Clean up vCenter with PowerShell after SCVMM leaves</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2009 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2009/01/clean-up-vcenter-with-powershell-after-scvmm-leaves/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

