<?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>VMUG Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/tag/vmug/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/tag/vmug/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 08 Apr 2020 10:56:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>VMUG Archives - LucD notes</title>
	<link>https://www.lucd.info/tag/vmug/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>How to run View PowerCLI</title>
		<link>https://www.lucd.info/2014/01/01/how-to-run-view-powercli/</link>
					<comments>https://www.lucd.info/2014/01/01/how-to-run-view-powercli/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 01 Jan 2014 17:28:04 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[remote session]]></category>
		<category><![CDATA[View]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Remote Session]]></category>
		<category><![CDATA[VMUG]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4618</guid>

					<description><![CDATA[During my recent presentation at the 20th VMUGBE+ session, I showed different ways [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>During my recent presentation at the <a href="https://erikerik.mygreencloud.be/?p=401" target="_blank" rel="noopener noreferrer">20th VMUGBE+</a> session, I showed different ways to run View PowerCLI cmdlets and scripts.</p>
<p>Several of the methods I showed, are already discussed on other blogs (to which I will include the links of course), but there is a new PowerShell feature that hasn&#8217;t been used until now (afaik).</p>
<p><a href="https://www.lucd.info/2014/01/01/how-to-run-view-powercli/view5/" rel="attachment wp-att-4629"><img fetchpriority="high" decoding="async" class="alignnone  wp-image-4629" alt="view5" src="https://lucd.info/wp-content/uploads/2014/01/view5.png" width="464" height="304" srcset="https://www.lucd.info/wp-content/uploads/2014/01/view5.png 580w, https://www.lucd.info/wp-content/uploads/2014/01/view5-300x196.png 300w" sizes="(max-width: 464px) 100vw, 464px" /></a></p>
<p>And since I never found a complete overview of all the available methods, I decided to create this post.</p>
<p><span id="more-4618"></span></p>
<h2>Method 1 &#8211; On a Connection Server</h2>
<p><a href="https://www.lucd.info/2014/01/01/how-to-run-view-powercli/view1/" rel="attachment wp-att-4620"><img decoding="async" class="alignnone size-full wp-image-4620" alt="view1" src="https://lucd.info/wp-content/uploads/2014/01/view1.png" width="411" height="238" srcset="https://www.lucd.info/wp-content/uploads/2014/01/view1.png 411w, https://www.lucd.info/wp-content/uploads/2014/01/view1-300x173.png 300w" sizes="(max-width: 411px) 100vw, 411px" /></a></p>
<h3>Method 1A &#8211; From the View PowerCLI prompt</h3>
<p>This is the most straightforward method, and also the first one shown in the <a href="http://pubs.vmware.com/view-52/topic/com.vmware.view.integration.doc/view_integration_powershell.5.1.html" target="_blank" rel="noopener noreferrer">View documentation</a>. You start a View PowerCLI session through the provided Start menu shortcut, or you start a plain PowerShell session and make sure the <strong>VMware.View.Broker</strong> PSSnapin is loaded.</p>
<p>Note that the View PowerCLI PSSNapin has a problem when you use it in a <strong>PowerShell v3</strong> (or higher) engine. A bypass for this problem is to start the PowerShell engine in <strong>Version 2 mode</strong>.</p>
<p>One way of doing that is by adding a parameter to the View PowerCLI shortcut in the Start menu. The following short script will update the Start menu entry to do this.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$extraArgument = &quot;-version 2 &quot;

if($PSVersionTable.PSVersion.Major -gt 2) {
  $relativePath = &quot;VMware\View PowerCLI.lnk&quot;
  $shell = New-Object -com &quot;WScript.Shell&quot;
  $start = $shell.SpecialFolders.item(&quot;AllUsersPrograms&quot;)
  $shortcut = $shell.CreateShortcut(&quot;$($start)\$relativePath&quot;)
  if($shortcut.Arguments -notmatch $extraArgument){
    $shortcut.Arguments = &quot;$($extraArgument)$($shortcut.Arguments)&quot;
    $shortcut.Save()
  }
}</pre><p></p>
<p>The shortcut will have an extra argument, the <a href="https://technet.microsoft.com/en-us/library/hh847899.aspx" target="_blank" rel="noopener noreferrer">Version parameter</a>, after you run the script on your Connection server.</p>
<p><a href="https://www.lucd.info/2014/01/01/how-to-run-view-powercli/view2/" rel="attachment wp-att-4621"><img decoding="async" class="alignnone  wp-image-4621" alt="view2" src="https://lucd.info/wp-content/uploads/2014/01/view2.png" width="634" height="226" srcset="https://www.lucd.info/wp-content/uploads/2014/01/view2.png 704w, https://www.lucd.info/wp-content/uploads/2014/01/view2-300x106.png 300w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p>A short demo of this</p>
<div style="width: 770px;" class="wp-video"><video class="wp-video-shortcode" id="video-4618-1" width="770" height="482" preload="metadata" controls="controls"><source type="video/mp4" src="https://lucd.info/wp-content/uploads/2014/01/demo2.mp4?_=1" /><a href="https://lucd.info/wp-content/uploads/2014/01/demo2.mp4">https://lucd.info/wp-content/uploads/2014/01/demo2.mp4</a></video></div>
<h3>Method 1B &#8211; As a PowerShell background job</h3>
<p>An alternative, that uses the same concept, is to run your View PowerCLI cmdlets and script as background jobs, and use the PSVersion parameter.</p>
<p>This method was described by <a href="https://twitter.com/andreleibovici" target="_blank" rel="noopener noreferrer">Andre Leibovici</a> in his <a href="https://myvirtualcloud.net/?p=4178" target="_blank" rel="noopener noreferrer">How to use VMware View PowerCLI with PowerShell 3.0</a> post.</p>
<p><a href="https://www.lucd.info/2014/01/01/how-to-run-view-powercli/view3/" rel="attachment wp-att-4623"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4623" alt="view3" src="https://lucd.info/wp-content/uploads/2014/01/view3.png" width="411" height="399" srcset="https://www.lucd.info/wp-content/uploads/2014/01/view3.png 411w, https://www.lucd.info/wp-content/uploads/2014/01/view3-300x291.png 300w" sizes="auto, (max-width: 411px) 100vw, 411px" /></a></p>
<p>A short demo of this method</p>
<div style="width: 770px;" class="wp-video"><video class="wp-video-shortcode" id="video-4618-2" width="770" height="482" preload="metadata" controls="controls"><source type="video/mp4" src="https://lucd.info/wp-content/uploads/2014/01/demo3.mp4?_=2" /><a href="https://lucd.info/wp-content/uploads/2014/01/demo3.mp4">https://lucd.info/wp-content/uploads/2014/01/demo3.mp4</a></video></div>
<p>The major disadvantage of this method in all it&#8217;s forms, is that you are logging on to a Connection Server and running your script interactively on the server. Something that might not be permitted in a production environment.</p>
<p>Another disadvantage, is that while you are running in a Version 2 engine, you will <strong>not have access</strong> to any of the PowerShell v3 (or higher) cmdlets.</p>
<h2>Method 2 &#8211; Remote Session</h2>
<p>The first mention of using a PowerShell Remote Session to run View PowerCLI cmdlets and scripts comes from <a href="https://twitter.com/alanrenouf" target="_blank" rel="noopener noreferrer">Alan Renouf</a> in his <a href="https://www.virtu-al.net/2011/05/28/using-the-view-powercli-cmdlets-from-another-machine/" target="_blank" rel="noopener noreferrer">Using the View PowerCLI cmdlets from another machine</a> post.</p>
<p><a href="https://twitter.com/andreleibovici" target="_blank" rel="noopener noreferrer">Andre Leibovici</a> did a post on this concept later on in his <a href="https://myvirtualcloud.net/?p=3474" target="_blank" rel="noopener noreferrer">Remote use of VMware.View.Broker PowerCLI</a> post. The great novelty that he introduced there, was that he uses PowerCLI&#8217;s <a href="https://www.vmware.com/support/developer/PowerCLI/PowerCLI55/html/Invoke-VMScript.html" target="_blank" rel="noopener noreferrer">Invoke-VMScript</a> cmdlet to configure the <a href="https://technet.microsoft.com/en-us/magazine/ff700227.aspx" target="_blank" rel="noopener noreferrer">winrm</a> settings on the Connection server.</p>
<p>But neither of these posts seems to mention that you need <strong>PowerShell v1 or v2</strong> on the Connection Server. And with the <a href="https://technet.microsoft.com/en-us/library/hh849717.aspx" target="_blank" rel="noopener noreferrer">New-PSSession</a> cmdlet you do not have the option to pass a <strong>Version</strong> parameter.</p>
<p>In <strong>PowerShell v4</strong> the <strong>PSSessionConfiguration</strong> concept was introduced. With the <a href="https://technet.microsoft.com/en-us/library/hh849741.aspx" target="_blank" rel="noopener noreferrer">Register-PSSessionConfiguration</a> cmdlet you create and register a session configuration on a computer. With this we can solve the requirement that the View PowerCLI PSSnapin needs PowerShell v1 or v2.</p>
<p><a href="https://www.lucd.info/2014/01/01/how-to-run-view-powercli/view4/" rel="attachment wp-att-4628"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4628" alt="view4" src="https://lucd.info/wp-content/uploads/2014/01/view4.png" width="482" height="342" srcset="https://www.lucd.info/wp-content/uploads/2014/01/view4.png 482w, https://www.lucd.info/wp-content/uploads/2014/01/view4-300x212.png 300w" sizes="auto, (max-width: 482px) 100vw, 482px" /></a></p>
<p>We can define a PS v2 configuration on the Connection Server remotly like this. Note that this assumes that remote sessions to the Connection server are already configured. If not, you can use Andre&#8217;s <strong>PSRemoteSession-Configure</strong> function to do that.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$PS2 = {Register-PSSessionConfiguration -Name PS2 -PSVersion 2.0 -Confirm:$false}
$session = New-PSSession -ComputerName view1
Invoke-Command -Session $session -ScriptBlock $PS2
Remove-PSSession -Session $session</pre><p></p>
<p>Once this session configuration is defined, we can run our View PowerCLI cmdlets and scripts like this</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$session = New-PSSession -ComputerName view1 -ConfigurationName PS2
Invoke-Command -Session $session -ScriptBlock {Add-PSSnapin VMware.View.Broker}
Invoke-Command -Session $session -ScriptBlock {Get-Pool}
Remove-PSSession -Session $session</pre><p></p>
<p>A short demo</p>
<div style="width: 770px;" class="wp-video"><video class="wp-video-shortcode" id="video-4618-3" width="770" height="482" preload="metadata" controls="controls"><source type="video/mp4" src="https://lucd.info/wp-content/uploads/2014/01/Demo4.mp4?_=3" /><a href="https://lucd.info/wp-content/uploads/2014/01/Demo4.mp4">https://lucd.info/wp-content/uploads/2014/01/Demo4.mp4</a></video></div>
<p>No more holding back on your PowerShell updates on the Connection servers.</p>
<p>A <strong>closing thought</strong>; the fact that the View PowerCLI PSSnapin officially still requires <strong>PowerShell v1</strong>, is to say the least annoying. Perhaps the team that develops the View PowerCLI PSSnapin could put <strong>PowerShell v4</strong> support, and a few other improvements I will gladly share with them if needed, on their New Year&#8217;s resolution list <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2014/01/01/how-to-run-view-powercli/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		<enclosure url="https://lucd.info/wp-content/uploads/2014/01/demo2.mp4" length="6448372" type="video/mp4" />
<enclosure url="https://lucd.info/wp-content/uploads/2014/01/demo3.mp4" length="1424444" type="video/mp4" />
<enclosure url="https://lucd.info/wp-content/uploads/2014/01/Demo4.mp4" length="2725138" type="video/mp4" />

			</item>
		<item>
		<title>Dutch VMUG: The Statistics Reporting Session</title>
		<link>https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/</link>
					<comments>https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Sun, 10 Feb 2013 12:38:18 +0000</pubDate>
				<category><![CDATA[Dutch]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[PowerShell]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4358</guid>

					<description><![CDATA[I had the pleasure to present a session on &#8220;PowerCLI and vSPhere Performance [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I had the pleasure to present a session on &#8220;PowerCLI and vSPhere Performance and Capacity reporting&#8221; during the Dutch VMUG meeting of February 8th 2013. Although the meeting took place in the &#8220;Karnaval&#8221; weekend, there was a great turnout and, as always, a very attentive and interested audience. Thanks for attending the session guys !</p>
<p style="padding-left: 60px;"><a href="https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/karnaval/" rel="attachment wp-att-4364"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4364" alt="karnaval" src="https://lucd.info/wp-content/uploads/2013/02/karnaval.jpg" width="300" height="225" /></a></p>
<p>In the session I tried to show how easy it is to produce decent performance and capacity reports about your vSphere environment with PowerCLI. During the session I did some demos to show some aspects of PowerCLI and statistics. This post contains the code, and some annotations, I used during these demos.</p>
<p><span id="more-4358"></span></p>
<p>I started off by showing what is available in PowerCLI for working with vSphere statistics.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag"># What is available in PowerCLI ?
Get-Command -Name *stat* -Module VMware.VimAutomation.Core

# Let's start with the intervals
Get-StatInterval

# What else is possible with this cmdlet ?
Get-Help -Name Get-StatInterval

# In PS v3 help can be displayed in a window
Get-Help -Name Get-StatInterval  -ShowWindow

# Our first source of information for the counters
Get-Help -Name Get-StatType -ShowWindow

# Let's try it out
Get-StatType -Entity esx1.local.test -Name cpu*

# There is a difference between the intervals

# Realtime
Get-StatType -Entity esx1.local.test -Name cpu* -Realtime |
Measure-Object | Select-Object -ExpandProperty Count

# Historical Interval 1
Get-StatType -Entity esx1.local.test -Name cpu* -Interval 300 |
Measure-Object | Select-Object -ExpandProperty Count

# Historical Interval 2
Get-StatType -Entity esx1.local.test -Name cpu* -Interval 1800 |
Measure-Object | Select-Object -ExpandProperty Count

# Historical Interval 3
Get-StatType -Entity esx1.local.test -Name cpu* -Interval 7200 |
Measure-Object | Select-Object -ExpandProperty Count

# Historical Interval 4
Get-StatType -Entity esx1.local.test -Name cpu* -Interval 86400 |
Measure-Object | Select-Object -ExpandProperty Count

# Retrieving the metrics
Get-Stat -Entity esx1.local.test -Stat cpu.usage.average -Realtime -MaxSamples 5

# The instance concept
# CPU
Get-Stat -Entity esx1.local.test -Stat cpu.usage.average -Realtime -MaxSamples 5 |
Group-Object -Property Instance

# Network
Get-Stat -Entity esx1.local.test -Stat net.received.average -Realtime -MaxSamples 5 |
Group-Object -Property Instance

# Some counters not available through Get-Stat
# Use the PerformanceManager methods
. ./Get-Stat2.ps1
Get-Stat2 -Entity (Get-VMHost esx1.local.test).ExtensionData -Stat net.received.average -QueryInstances -Interval RT</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 10</strong>: In <strong>PowerShell v3</strong> you can have your help displayed in a separate window, very handy to have the window open while writing your code.</p>
<p><strong>Line 13-39</strong>: The <a href="https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Get-StatType.html" target="_blank">Get-StatType</a> cmdlet is used to find which counters are available for which VIObject in which time interval. See my <a href="https://www.lucd.info/2009/12/30/powercli-vsphere-statistics-part-1-the-basics/" target="_blank">PowerCLI &amp; vSphere statistics – Part 1 – The basics</a> post for additional info on counters.</p>
<p><strong>Line 21-39</strong>: Depending on the interval you select, and the Statistics Level that is set in your vCenter, you will see a different number of available counters.</p>
<p><strong>Line 44-51</strong>: Several counters return metrics for all the available instances and an aggregate counter. That aggregate metric is in fact the average over all the available instances. On the <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/vim.PerformanceManager.html" target="_blank">PerformanceManager</a> pages that list the counters, you can see if a specific counter reports on instances or not. This also the first sample use of the Group-Object cmdlet, a cmdlet you must master when you are working with vSphere metrics.</p>
<p><a href="https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/vmug-instance/" rel="attachment wp-att-4359"><img loading="lazy" decoding="async" class="alignnone  wp-image-4359" alt="VMUG-instance" src="https://lucd.info/wp-content/uploads/2013/02/VMUG-instance.png" width="582" height="56" srcset="https://www.lucd.info/wp-content/uploads/2013/02/VMUG-instance.png 970w, https://www.lucd.info/wp-content/uploads/2013/02/VMUG-instance-300x28.png 300w" sizes="auto, (max-width: 582px) 100vw, 582px" /></a></p>
<p><strong>Line 53-56</strong>: In the current PowerCLI release some counters can not be retrieved with the <a href="https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Get-Stat.html" target="_blank">Get-Stat</a> cmdlet. In that case you will have to fall back on the <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/vim.PerformanceManager.html#queryStats" target="_blank">QueryPerf</a> method available on the <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/vim.PerformanceManager.html" target="_blank">PerformanceManager</a> object. Or you can use my <a href="https://www.lucd.info/download/Get-Stat2.ps1" target="_blank">Get-Stat2</a> function where I encapsulated that method in a PowerShell function.</p>
<p><strong>Line 55</strong>: This line shows dot-sourcing at work. The code for the Get-Stat2 function is stored in the file Get-Stat2.ps1 and with the dot-sourcing we tell the PowerShell engine to read the file and thus &#8220;know&#8221; the definition of the function. After this dot-sourcing of the file, we can use the Get-Stat2 as a normal cmdlet in our scripts. This avoids that we will have to include this function code in all our scripts.</p>
<p>In the following script I present a quick method to create your own Counter Reference page.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$perfMgr = Get-View (Get-View ServiceInstance).content.perfManager

$perfMgr.PerfCounter |
Select @{N=&quot;Counter&quot;;E={$_.GroupInfo.Key + &quot;.&quot; + $_.NameInfo.Key + &quot;.&quot; + $_.RollupType}},
  @{N=&quot;Description&quot;;E={$_.NameInfo.Summary}},
  Level,@{N=&quot;Unit&quot;;E={$_.UnitInfo.Key}},StatsType,Key |
Sort-Object -Property Counter |
Export-Xlsx -AutoFilter -FreezePanes -Path E:\SkyDrive\Scripts\vSphere-Counter-Xref.xlsx</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 8</strong>: The <strong>Exports-Xlsx</strong> function is available in <a href="https://www.lucd.info/2013/01/03/export-xls-the-sequel-and-ordered-data/" target="_blank">Export-Xlsx, the sequel, and ordered data</a>, or on Gilbert&#8217;s blog <a href="https://www.itpilgrims.com/" target="_blank">ITPilgrims A personal sandbox</a>.</p>
<p>The resulting worksheet looks something like this.</p>
<p><a href="https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/vmug-xref/" target="_blank" rel="attachment wp-att-4360"><img loading="lazy" decoding="async" class="alignnone  wp-image-4360" alt="VMUG-XRef" src="https://lucd.info/wp-content/uploads/2013/02/VMUG-XRef.png" width="837" height="254" srcset="https://www.lucd.info/wp-content/uploads/2013/02/VMUG-XRef.png 1196w, https://www.lucd.info/wp-content/uploads/2013/02/VMUG-XRef-300x91.png 300w, https://www.lucd.info/wp-content/uploads/2013/02/VMUG-XRef-1024x310.png 1024w" sizes="auto, (max-width: 837px) 100vw, 837px" /></a></p>
<p>The <strong>Level</strong> column shows the Statistics Level at which this counter is available.</p>
<p>The <strong>StatType</strong> column shows the type of statistical measurement that is used for a counter. See <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/vim.PerformanceManager.CounterInfo.StatsType.html" target="_blank">PerfStatsType</a>.</p>
<p>The <strong>Key</strong> column shows the internal key that vCenter uses for the counter. This value is unique for each environment, it depends on the features and components that are installed in your vCenter. This Key is used when you create for example an Alarm that is triggered on a performance counter exceeding a threshold. See for example <a href="https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/" target="_blank">Alarm expressions – Part 1 : Metric alarms</a>.</p>
<p>In the following demo I tried to show how you can improve the performance of your statistic data gathering scripts. The first script shows the non-optimal method of gathering the data. A Get-Stat call for each counter and for each VIObject.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Measure-Command {
  $esxAll = Get-VMHost
  $metrics = &quot;cpu.usage.average&quot;,&quot;mem.usage.average&quot;

  foreach($esx in $esxAll){
    foreach($metric in $metrics){
      Get-Stat -Entity $esx -Stat $metric -Realtime |
      Select Timestamp,Entity,MetricId,Value
    }
}} | Select -ExpandProperty TotalMilliseconds</pre><p></p>
<p>By limiting this to just one Get-Stat call your script will be considerably faster.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Measure-Command {
  $esxAll = Get-VMHost
  $metrics = &quot;cpu.usage.average&quot;,&quot;mem.usage.average&quot;

  Get-Stat -Entity $esxAll -Stat $metrics -Realtime |
  Select Timestamp,Entity,MetricId,Value
} | Select -ExpandProperty TotalMilliSeconds</pre><p></p>
<p>The use of the Group-Object cmdlet is key when retrieving statistical data. It allows your script to execute only one Get-Stat call and then separate the retrieved metrics based on a number of properties of the returned objects.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$esx = Get-VMHost
$metrics = &quot;net.bytesRx.average&quot;

Get-Stat -Entity $esx -Stat $metrics |
where {$_.Instance -ne &quot;&quot;} |
Group-Object -Property {$_.Entity.Name,$_.Instance} |
Select @{N=&quot;VMHost&quot;;E={$_.Values[0][0]}},
  @{N=&quot;vmnic&quot;;E={$_.Values[0][1]}},
  @{N=&quot;Counter&quot;;E={$_.Group[0].MetricId}},
  @{N=&quot;Avg Received&quot;;E={
    $_.Group | Select -ExpandProperty Value |
    Measure-Object -Average | Select -ExpandProperty Average
  }},
  @{N=&quot;From&quot;;E={
    $_.Group | Sort-Object -Property Timestamp |
    Select -First 1 | Select -ExpandProperty Timestamp
  }},
  @{N=&quot;To&quot;;E={
    $_.Group | Sort-Object -Property Timestamp -Descending |
    Select -First 1 | Select -ExpandProperty Timestamp
  }} |
Format-Table -AutoSize</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 5</strong>: We don&#8217;t want the aggregate metric for this report, so we filter it out with a Where-clause</p>
<p><strong>Line 6</strong>: The returned metrics are grouped by the name of the entity and the instance.</p>
<p><strong>Line 10-13</strong>: Another cmdlet that is indispensable for working with statistical data is the Measure-Object cmdlet, it allows you to perform simple statistical functions on the data.</p>
<p><strong>Line 14-20</strong>: In the results we want to see over which time period the data was collected, so we use the Timestamp on the first and the last returned metric to get these DateTime values.</p>
<p>The final demos showed some ways to add graphics to your reports.</p>
<p>The first one uses the Chart feature of Excel. With the Export-Xlsx function you easily add a chart to the worksheet or on a separate worksheet.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$esx = Get-VMHost esx1.local.test
$metric = &quot;datastore.totalReadLatency.average&quot;

Get-Stat -Entity $esx -Stat $metric -Realtime -MaxSamples 25 |
where {$_.Instance -ne &quot;&quot;} |
Sort-Object -Property Timestamp |
Group-Object -Property Timestamp | %{
  $propSplat = [ordered]@{
    Timestamp = $_.Values[0][0].ToString(&quot;hh:mm:ss&quot;)
  }
  $_.Group | Sort-Object -Property Instance | %{
    $propSplat.Add($_.Instance,$_.Value)
  }
  New-Object PSObject -Property $propSplat
} | Export-Xlsx -Path e:\skydrive\scripts\demo2a.xlsx -ChartType xlLine -WorksheetName $esx.Name</pre><p></p>
<p>This way you have access to nearly all the charting features that are available in Excel. The result looks something like this.</p>
<p><a href="https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/vmug-chart1/" target="_blank" rel="attachment wp-att-4361"><img loading="lazy" decoding="async" class="alignnone  wp-image-4361" alt="VMUG-chart1" src="https://lucd.info/wp-content/uploads/2013/02/VMUG-chart1.png" width="533" height="434" srcset="https://www.lucd.info/wp-content/uploads/2013/02/VMUG-chart1.png 666w, https://www.lucd.info/wp-content/uploads/2013/02/VMUG-chart1-300x244.png 300w" sizes="auto, (max-width: 533px) 100vw, 533px" /></a></p>
<p>You can also use a commercial product like for example <a href="https://www.softwarefx.com/sfxSqlProducts/powerGadgets/" target="_blank">PowerGadgets</a>. They offer a number of cmdlets to produce and annotate graphs.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$esx = Get-VMHost esx1.local.test
$metric = &quot;datastore.totalWriteLatency.average&quot;

$array = Get-Stat -Entity $esx -Stat $metric -Realtime -MaxSamples 25 |
where {$_.Instance -ne &quot;&quot;} |
Sort-Object -Property Timestamp |
Group-Object -Property Timestamp | %{
  $propSplat = [ordered]@{
    Timestamp = $_.Values[0][0].ToString(&quot;hh:mm:ss&quot;)
  }
  $_.Group | Sort-Object -Property Instance | %{
    $propSplat.Add($_.Instance,$_.Value)
  }
  New-Object PSObject -Property $propSplat
}

$values = $array | gm -MemberType NoteProperty | where {$_.Name -ne &quot;Timestamp&quot;} | %{$_.Name}
$array | Out-Chart -Gallery Lines `
  -AllSeries_MarkerSize 0 `
  -Title &quot;Datastore Write Latency&quot; `
  -AxisX_Title_Text &quot;Date&quot; `
  -AxisY_Title_Text &quot;msec&quot; `
  -Values $values `
  -Label {([datetime]::Parse($_.Timestamp,$localCulture)).ToString(&quot;hh:mm:ss&quot;)}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 17</strong>: In the <strong>$values</strong> variable the script collects the names of the <strong>Instances</strong>, which are the property names in the objects that were created before. These names are used to define which columns contain the data that needs to be added to the produced graph.</p>
<p><strong>Line 19-24</strong>: There are numerous parameters on the <strong>Out-Chart</strong> cmdlet that can be used to annotate the produced graph.</p>
<p><strong>Line 24</strong>: Since we collected the metrics in the <strong>Realtime</strong> interval we only want to see the time part of the <strong>Timestamp</strong> property. Notice how you easily use a .Net function in your PowerShell scripts.</p>
<p>The result looks something like this.</p>
<p><a href="https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/powergadgets-demo3b/" target="_blank" rel="attachment wp-att-4362"><img loading="lazy" decoding="async" class="alignnone  wp-image-4362" alt="PowerGadgets-Demo3b" src="https://lucd.info/wp-content/uploads/2013/02/PowerGadgets-Demo3b.png" width="596" height="268" srcset="https://www.lucd.info/wp-content/uploads/2013/02/PowerGadgets-Demo3b.png 993w, https://www.lucd.info/wp-content/uploads/2013/02/PowerGadgets-Demo3b-300x134.png 300w" sizes="auto, (max-width: 596px) 100vw, 596px" /></a></p>
<p>This post can of course not replace a &#8220;live&#8221; session, but I hope the demos that are in this post will help you to do your own discovery tour of PowerCLI, vSphere statistics and reporting.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2013/02/10/dutch-vmug-the-statistics-reporting-session/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>Belgian VMUG event #17, the &#8220;Blogger Edition&#8221;</title>
		<link>https://www.lucd.info/2012/06/01/belgian-vmug-17/</link>
					<comments>https://www.lucd.info/2012/06/01/belgian-vmug-17/#respond</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 01 Jun 2012 20:35:10 +0000</pubDate>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Belgium]]></category>
		<category><![CDATA[VMUG]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4055</guid>

					<description><![CDATA[Today was a historic day for the Belgian VMUG. The 17th edition, the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today was a historic day for the <strong>Belgian VMUG</strong>.</p>
<p>The <strong>17th edition</strong>, the so-called &#8220;<em>Blogger Edition</em>&#8220;, was completely sold out. All <strong>170 attendees</strong>, a new record, had a great day and the presenters  all gave a peak performance. The list of presenters was impressive to say the least.</p>
<p>I was honored to have been selected to do a presentation as well. Since it was in Belgium, I decided to give the subject of my session a local twist. The subject was PowerCLI and beer, you can&#8217;t live without them.</p>
<p>You&#8217;ll be missing the story I told during the presentation, but on request, the slides.</p>
<p><span style="background-color: #ffff00;"><strong>Update</strong></span>: all presentations are now available <a href="https://t.co/QAk665hW" target="_blank">here</a> (requires a VMUG account).</p>
<p><span id="more-4055"></span></p>
<p><iframe loading="lazy" src="https://app.sliderocket.com:80/app/fullplayer.aspx?id=209d112a-7314-4ee3-9d33-d4a7d8acfa61" frameborder="0" scrolling="no" width="600" height="481"></iframe></p>
<p>Thanks again to <a href="https://twitter.com/#!/erikschils" target="_blank">Erik Schils</a> for organising a great VMUG meeting (and for having me). And thanks to <a href="https://www.cisco.com/web/BE/about/contacts.html" target="_blank">Cisco Belgium</a> for providing the pleasant environment.</p>
<p>Let&#8217;s do this again soon !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2012/06/01/belgian-vmug-17/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>vSphere 5 Top 10 – VMFS5</title>
		<link>https://www.lucd.info/2011/12/19/vsphere-5-top-10-vmfs5/</link>
					<comments>https://www.lucd.info/2011/12/19/vsphere-5-top-10-vmfs5/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Mon, 19 Dec 2011 21:22:05 +0000</pubDate>
				<category><![CDATA[2011]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMFS5]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[datastore]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3772</guid>

					<description><![CDATA[Continuing my Dutch VMUG Event 2011 presentation series with a post on the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Continuing my <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=section&amp;layout=blog&amp;id=5&amp;Itemid=55" target="_blank">Dutch VMUG Event 2011 presentation</a> series with a post on the <strong>VMFS5</strong> feature. This feature clocked in at position 8 in the Top 10.</p>
<p>With <strong>VMFS5</strong> comes a bunch of new features. Just to name a few:</p>
<ul>
<li>64TB VMFS Volumes in 1 extent</li>
<li>64TB physical RDM</li>
<li>Unified block size of 1MB</li>
<li>Support for more files (&gt; 100000)</li>
</ul>
<p>For a complete list of the features that <strong>VMFS5</strong> introduces, have a look at <a href="https://twitter.com/#!/VMwareStorage" target="_blank">Cormac</a>&#8216;s post, called <a href="https://blogs.vmware.com/vsphere/2011/07/new-vsphere-50-storage-features-part-1-vmfs-5.html" target="_blank">vSphere 5.0 Storage Features Part 1 &#8211; VMFS-5</a>.</p>
<p><span id="more-3772"></span></p>
<p>The vSphere 5 Client has an option to upgrade your <strong>VMFS3</strong> datastores to <strong>VMFS5</strong> datastores.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vmfs3-vclient-vsphere5-upgrade.png"><img loading="lazy" decoding="async" class="alignnone  wp-image-3776" title="vmfs3-vclient-vsphere5-upgrade" src="https://lucd.info/wp-content/uploads/2011/12/vmfs3-vclient-vsphere5-upgrade.png" alt="" width="566" height="182" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-vclient-vsphere5-upgrade.png 707w, https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-vclient-vsphere5-upgrade-300x96.png 300w" sizes="auto, (max-width: 566px) 100vw, 566px" /></a></p>
<p>Handy option, but we want to <strong>automate</strong> this of course <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>And as a bonus I&#8217;ll throw in a function to get the <strong>partition information</strong> from a datastore.</p>
<h2>The script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function ConvertTo-Vmfs5{
&lt;#
.SYNOPSIS  Upgrade a datastore to VMFS5
.DESCRIPTION The function will convert the datastores that
  are passed to it to VMFS5.
.NOTES  Author:  Luc Dekens
.PARAMETER Datastore
  The datastore(s) to be upgraded
  The parameter accepts a string or an object returned by the
  Get-Datastore cmdlet.
.EXAMPLE
  PS&gt; ConvertTo-Vmfs5 -Datastore &quot;DS*&quot;
.EXAMPLE
  PS&gt; Get-Datastore -Name &quot;DS1&quot; | ConvertTo-Vmfs5
#&gt;

  param(
  [CmdletBinding()]
  [parameter(Mandatory = $true, ValueFromPipeline = $true)]
  [PSObject[]]$Datastore
  )

  process{
    foreach($ds in $Datastore){
      if($ds.getType().Name -eq &quot;string&quot;){
        $ds = Get-Datastore -Name $ds
      }
      $poweredHosts = $ds.ExtensionData.Host | %{Get-View -Id $_.Key} |
      where {$_.Runtime.PowerState -eq &quot;PoweredOn&quot;}
      
      $oldHost = $poweredHosts | 
      where {$_.Capability.SupportedVmfsMajorVersion -notcontains 5}
      if($oldHost){
        Write-Warning &quot;One of the connected hosts doesn't support VMFS5&quot;
        exit
      }
      $vmfsPath = $ds.ExtensionData.Host[0].MountInfo.Path
      $storSys = Get-View ($poweredHosts | Get-Random).ConfigManager.StorageSystem

      $storSys.UpgradeVmfs($vmfsPath)
    }
  }
}

function Get-VmfsPartitionInfo{
&lt;#
.SYNOPSIS  Retrieves partition info for a datastore
.DESCRIPTION The function will retrieve partition information
  for one or more datastores
.NOTES  Author:  Luc Dekens
.PARAMETER Datastore
  The datastore(s) for which the partition info shall be
  returned. The parameter accepts a string or an object
  returned by the Get-Datastore cmdlet.
.EXAMPLE
  PS&gt; Get-VmfsPartitionInfo -Datastore &quot;DS*&quot;
.EXAMPLE
  PS&gt; Get-Datastore -Name &quot;DS1&quot; | Get-VmfsPartitionInfo
#&gt;
  param(
  [CmdletBinding()]
  [parameter(Mandatory = $true, ValueFromPipeline = $true)]
  [PSObject[]]$Datastore
  )

  process{
    foreach($ds in $Datastore){
      if($ds.getType().Name -eq &quot;string&quot;){
        $ds = Get-Datastore -Name $ds
      }
      $poweredHosts = $ds.ExtensionData.Host | %{Get-View -Id $_.Key} |
      where {$_.Runtime.PowerState -eq &quot;PoweredOn&quot;}
      $storSys = Get-View ($poweredHosts | Get-Random).ConfigManager.StorageSystem

      $ds.ExtensionData.Info.Vmfs.Extent | %{
        $devicePath = &quot;/vmfs/devices/disks/&quot; + $_.DiskName
        $storSys.RetrieveDiskPartitionInfo($devicePath) | %{
          New-Object PSObject -Property @{
            Name = $ds.Name
            Version = $ds.FileSystemVersion
            Device = $_.DeviceName
            PartitionFormat = $_.Spec.PartitionFormat
            BlockSizeMB = $ds.ExtensionData.Info.Vmfs.BlockSizeMb
            Blocks = $_.Layout.Total.Block
          }
        }
      }
    }
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 25-27</strong>: A rather simple Object By Name implementation.</p>
<p><strong>Line 28-29</strong>: Collect the hosts, connected to the datastore, that are powered on. The reason is that we can&#8217;t use the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.host.StorageSystem.html#upgradeVmfs" target="_blank">UpgradeVmfs</a> method via the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.host.StorageSystem.html#upgradeVmfs" target="_blank">StorageSystem</a> of a powered off host.</p>
<p><strong>Line 31-36</strong>: Check if all the powered on and connected hosts support VMFS5. If not, leave the function.</p>
<p><strong>Line 37</strong>: Get the devicepath to the datastore.</p>
<p><strong>Line 38</strong>: Get the HostStorageSystem. Note that the function randomly selects 1 host from the powered on hosts. There is no real reason to do this, but I wanted to spread the method call over all available hosts.</p>
<p><strong>Line 40</strong>: Convert the datastore to VMFS5</p>
<p><strong>Line 68-70</strong>: Another example of my rather simple Object By Name implementation.</p>
<p><strong>Line 71-73</strong>: We randomly take 1 of the connected hosts to fetch the HostStorageSystem.</p>
<p><strong>Line 75</strong>: We loop through each VMFS extent of the datastore</p>
<p><strong>Line 76-77</strong>: The function uses the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.host.StorageSystem.html#retrieveDiskPartitionInfo" target="_blank">RetrieveDiskPartitionInfo</a> method to fetch the partition information.</p>
<p><strong>Line 78-85</strong>: The function fetches the information for each partition and puts it on the pipeline as a PSObject.</p>
<h2>Sample usage</h2>
<p>In our vSphere 4 environment we have a number of VMFS3 datastores.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vmfs3-cli.png"><img loading="lazy" decoding="async" class="alignnone wp-image-3777" title="vmfs3-cli" src="https://lucd.info/wp-content/uploads/2011/12/vmfs3-cli.png" alt="" width="524" height="112" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-cli.png 655w, https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-cli-300x64.png 300w" sizes="auto, (max-width: 524px) 100vw, 524px" /></a></p>
<p>First, I use the <strong>Get-VmfsPartition</strong> function to check the partitioninfo of each datastore.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Datastore DS* | Get-VmfsPartitionInfo | ft -AutoSize</pre><p></p>
<p>The result.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vmfs3-partition-info.png"><img loading="lazy" decoding="async" class="alignnone  wp-image-3783" title="vmfs3-partition-info" src="https://lucd.info/wp-content/uploads/2011/12/vmfs3-partition-info.png" alt="" width="600" height="102" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-partition-info.png 750w, https://www.lucd.info/wp-content/uploads/2011/12/vmfs3-partition-info-300x50.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>Notice the <strong>BlockSizeMB</strong> column in the output, all 4 possible blocksizes for VMFS3 datastores are present.</p>
<p>Let&#8217;s upgrade these VMFS3 datastores to VMFS5 datastores.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Datastore DS* | ConvertTo-Vmfs5</pre><p></p>
<p>The convert function produces no output, but we can check what the new properties are with the <strong>Get-VmfsPartitionInfo</strong> function.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/vmfs5-partition-info.png"><img loading="lazy" decoding="async" class="alignnone  wp-image-3785" title="vmfs5-partition-info" src="https://lucd.info/wp-content/uploads/2011/12/vmfs5-partition-info.png" alt="" width="618" height="105" srcset="https://www.lucd.info/wp-content/uploads/2011/12/vmfs5-partition-info.png 772w, https://www.lucd.info/wp-content/uploads/2011/12/vmfs5-partition-info-300x50.png 300w" sizes="auto, (max-width: 618px) 100vw, 618px" /></a></p>
<p>The VMFS version is <strong>5.54</strong>, so the conversion worked.</p>
<p>But the attentive viewer might have noticed a couple of values he didn&#8217;t expect.</p>
<ul>
<li>The PartitionFormat still says &#8216;MBR&#8217;. Shouldn&#8217;t that be &#8216;GPT&#8217; ?</li>
<li>The BlocksizeMB stayed the same as before the VMFS5 conversion. Shouldn&#8217;t that be 1MB for VMFS5 datastores ?</li>
</ul>
<p>The answer to both questions can be found in Cormac&#8217;s post called <a href="https://blogs.vmware.com/vsphere/2011/07/new-vsphere-50-storage-features-part-1-vmfs-5.html" target="_blank">vSphere 5.0 Storage Features Part 1 &#8211; VMFS-5</a>.</p>
<ul>
<li>A converted datastores keeps the &#8216;MBR&#8217; format until it grows bigger than 2TB.</li>
<li>A converted datastores keeps the original VMFS3 blocksize.</li>
</ul>
<p>And I want to repeat Cormac&#8217;s final advise in his post, if you have the luxury to do so, it&#8217;s better to create new VMFS5 datastores instead of converting VMFS3 datastores !</p>
<h2>VIProperty</h2>
<p>Derived from the <strong>Get-VmfsPartitionInfo</strong> function, I created a <strong>New-VIProperty</strong> definition to return the format of the first datastore partition.</p><pre class="urvanov-syntax-highlighter-plain-tag">New-VIProperty -Name PartitionFormat -ObjectType Datastore `
  -Value {
    param($ds)

    $storSys = Get-View (Get-View $ds.ExtensionData.Host[0].Key).ConfigManager.StorageSystem
    $partInfo = $storSys.RetrieveDiskPartitionInfo(&quot;/vmfs/devices/disks/&quot; + 
      $ds.ExtensionData.Info.Vmfs.Extent[0].DiskName)
    $partInfo[0].Spec.PartitionFormat
  } -Force | Out-Null</pre><p>Note that you will only get the partition format (MBR or GPT) when you use this in a vSphere 5, or higher, environment. The <strong>partitionFormat</strong> property in the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.host.DiskPartitionInfo.Specification.html" target="_blank">HostDiskPartitionSpec</a> object is only available since API 5.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/12/19/vsphere-5-top-10-vmfs5/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>vSphere 5 Top 10 &#8211; NetIOC</title>
		<link>https://www.lucd.info/2011/12/15/vsphere-5-top-10-netioc/</link>
					<comments>https://www.lucd.info/2011/12/15/vsphere-5-top-10-netioc/#respond</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Thu, 15 Dec 2011 21:16:42 +0000</pubDate>
				<category><![CDATA[2011]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[dvSwitch]]></category>
		<category><![CDATA[NetIOC]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3747</guid>

					<description><![CDATA[Another post from our Dutch VMUG Event 2011 presentation. This time it&#8217;s about [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Another post from our <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=section&amp;layout=blog&amp;id=5&amp;Itemid=55" target="_blank">Dutch VMUG Event 2011 presentation</a>. This time it&#8217;s about number 5 in the Top-10, Network I/O Control. This feature allows <strong>user-defined network resource pools</strong> and end-to-end <strong>QoS</strong>.</p>
<p>Note that this feature requires <strong>distributed Switches</strong> (dvSwitch). In fact I could have also written this post in my <a href="https://www.lucd.info/tag/dvswitch/" target="_blank">dvSwitch series</a> with the title <strong>dvSwitch scripting – Part 10 – NetIOC</strong>.</p>
<h2><span id="more-3747"></span>The script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function New-dvSwNetworkResourcePool{
&lt;#
.SYNOPSIS Create a user-defined network resource pool
.DESCRIPTION The function will create a user-defined
  resourcepool on a specific dvSwitch.
.NOTES  Author:  Luc Dekens
.PARAMETER dvSw
  The dvSwitch on which the user-defined network resource pool
  will be created.
.PARAMETER Name
  The name of the user-defined network resource pool.
.PARAMETER Description
  The description of the user-defined network resource pool.
.PARAMETER QoSTag
  The QoSTag that will be assigned to the user-defined
  network resource pool. A value from the range 0-7.
.PARAMETER Limit
  The QoSTag that will be assigned to the user-defined
  network resource pool. A value from the range 0-7.
.PARAMETER Shares
  The number of shares allocated. Can be &quot;low&quot;,&quot;normal&quot;,&quot;high&quot;
  or a number (a relative value compared with the shares value
  on other resource pools in case of contention)
.EXAMPLE
  PS&gt; New-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool1&quot; `
  PS&gt;&gt; -Description &quot;Dutch VMUG 2011&quot;
.EXAMPLE
  PS&gt; New-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool2&quot; `
  PS&gt;&gt; -Description &quot;Dutch VMUG 2011&quot; -Shares 75 -QoSTag 3
#&gt;
  param(
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [VMware.Vim.VmwareDistributedVirtualSwitch]$dvSw,
  [parameter(Position = 1, Mandatory = $true)]
  [string]$Name,
  [parameter(Position = 2)]
  [string]$Description,
  [string]$QoSTag,
  [long]$Limit = -1,
  [string]$Shares = &quot;normal&quot;
  )

  $spec = New-Object VMware.Vim.DVSNetworkResourcePoolConfigSpec
  $spec.Name = $Name
  $spec.Description = $Description
  $spec.Key = &quot;dummy&quot;
  $spec.allocationInfo = New-Object VMware.Vim.DVSNetworkResourcePoolAllocationInfo
  $spec.allocationInfo.Limit = $Limit
  $spec.allocationInfo.priorityTag = &amp;{if($QoSTag){[int]$QoSTag}}
  $spec.allocationInfo.Shares = New-Object VMware.Vim.SharesInfo
  if(&quot;high&quot;,&quot;low&quot;,&quot;normal&quot; -contains $Shares){
    $spec.allocationInfo.Shares.Level = $Shares
  }
  else{
    $spec.allocationInfo.Shares.Level = &quot;custom&quot;
    $spec.allocationInfo.Shares.Shares = [int]$Shares
  }

  $dvSw.AddNetworkResourcePool(@($spec))
}

function Remove-dvSwNetworkResourcePool{
&lt;#
.SYNOPSIS Remove a user-defined network resource pool
.DESCRIPTION The function will remove a user-defined
  resource pool from a specific dvSwitch.
.NOTES  Author:  Luc Dekens
.PARAMETER dvSw
  The dvSwitch on which the user-defined network resource pool
  shall be removed.
.PARAMETER Name
  The name of the user-defined network resource pool.
.EXAMPLE
  PS&gt; Remove-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool1&quot;
#&gt;
  param(
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [VMware.Vim.VmwareDistributedVirtualSwitch]$dvSw,
  [parameter(Position = 1, Mandatory = $true)]
  [string]$Name
  )

  $pool = $dvSw.NetworkResourcePool | where {$_.Name -eq $Name}
  if($pool){
    $dvSw.RemoveNetworkResourcePool($pool.Key)
  }
}

function Get-dvSwNetworkResourcePool{
&lt;#
.SYNOPSIS Retrieve user-defined network resource pool(s)
.DESCRIPTION The function return all or a specific set
  of user-defined network resource pools from a dvSwitch
.NOTES  Author:  Luc Dekens
.PARAMETER dvSw
  The dvSwitch from which the user-defined network resource pool
  shall be retrieved.
.PARAMETER Name
  The name of the user-defined network resource pool.
  If no name is specified, all user-defined network
  resource pools on the dvSwitch will be returned.
.EXAMPLE
  PS&gt; Get-dvSwNetworkResourcePool -dvSw $dvSw
.EXAMPLE
  PS&gt; Get-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;Net*&quot;
#&gt;
  param(
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [VMware.Vim.VmwareDistributedVirtualSwitch]$dvSw,
  [parameter(Position = 1)]
  [string]$Name = &quot;*&quot;
  )

  $dvSw.UpdateViewData()
  $dvSw.NetworkResourcePool | where {$_.Name -like $Name} | %{
    New-Object PSObject -Property @{
      Name = $_.Name
      Description = $_.Description
      Limit = $_.AllocationInfo.Limit
      QoSTag = &amp;{if($_.AllocationInfo.PriorityTag -eq 0){&quot;none&quot;}else{$_.AllocationInfo.PriorityTag}}
      Shares = &amp;{if($_.AllocationInfo.Shares.Level -eq &quot;custom&quot;){$_.AllocationInfo.Shares.Shares}else{$_.AllocationInfo.Shares.Level}}
    }
  }
}

function Set-dvSwSIOC{
&lt;#
.SYNOPSIS Enable/disable NetIOC on a dvSw
.DESCRIPTION The function will enable or disable
  I/O Control on a dvSwitch
.NOTES  Author:  Luc Dekens
.PARAMETER dvSw
  The dvSwitch on which I/O Control will be
  enabled/disabled
.PARAMETER Enabled
  A switch that allows control of I/O Control. When
  the switch is $True, IOC will be enabled. If $False
  IOC will be disabled
.EXAMPLE
  PS&gt; Set-dvSwSIOC -dvSw $dvSw -Enabled
#&gt;
  param(
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [VMware.Vim.VmwareDistributedVirtualSwitch]$dvSw,
  [parameter(Position = 1)]
  [switch]$Enabled
  )

  $dvSw.EnableNetworkResourceManagement($Enabled)
}

function Get-dvSwSIOC{
&lt;#
.SYNOPSIS Retrieve the IOC status
.DESCRIPTION Returns the status of IOC on a dvSwitch
.NOTES  Author:  Luc Dekens
.PARAMETER dvSw
  The dvSwitch from which the status of I/O Control will be
  returned
.EXAMPLE
  PS&gt; Get-dvSwSIOC -dvSw $dvSw -Enabled
#&gt;
  param(
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [VMware.Vim.VmwareDistributedVirtualSwitch]$dvSw
  )

  $dvSw.UpdateViewData()
  New-Object PSObject -Property @{
    Name = $dvSw.Name
    SIOCEnabled = $dvSw.Config.NetworkResourceManagementEnabled
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 38</strong>: Although the QosTag is an [int], we use the [string] cast. Otherwise the absence of the parameter would set QosTag to 0, which is a valid 802.1p value.</p>
<p><strong>Line 38-40</strong>: The absence of these 3 parameters on a call to the function will create a user-defined network resource pool with the same settings as if the resource pool was created in the vSphere Client.</p>
<p><strong>Line 51-57</strong>: If the Shares parameter is not set to &#8220;normal&#8221;, &#8220;high&#8221; or &#8220;low&#8221;, it will be set to &#8220;custom&#8221; and the Shares value will be used as an [int] value.</p>
<p><strong>Line 80</strong>: The removal of a user-defined network resource pool requires the Name parameter to be set.</p>
<p><strong>Line 111</strong>: If no Name parameter is used, all the user-defined network resource pools on the dvSwitch will be returned.</p>
<p><strong>Line 114</strong>: To get the most recent data, the script refreshes the dvSwitch object.</p>
<p><strong>Line 120</strong>: This test will make sure, that the function returns the same values as displayed in the vSphere Client.</p>
<p><strong>Line 121</strong>: When the Shares level is &#8220;custom&#8221;, the [int] value of the share will be returned.</p>
<h2>Sample usage</h2>
<p>We start with an empty dvSwitch. The Get-dvSwitch function can be found in my <a href="https://www.lucd.info/2009/10/12/dvswitch-scripting-part-2-dvportgroup/" target="_blank">dvSwitch scripting – Part 2 – dvPortgroup</a> post.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NETIOC-initial.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3754" title="NETIOC-initial" src="https://lucd.info/wp-content/uploads/2011/12/NETIOC-initial.png" alt="" width="490" height="196" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-initial.png 612w, https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-initial-300x120.png 300w" sizes="auto, (max-width: 490px) 100vw, 490px" /></a></p>
<p>First we get the dvSwitch and we get a list of the current network resource pools.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$dvSw = Get-dvSwitch -DatacenterName &quot;DC1&quot; -dvSwitchName &quot;dvSw1&quot;
Get-dvSwNetworkResourcePool -dvSw $dvSw | ft -AutoSize</pre><p></p>
<p>This will return the system network resource pools.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system-cli.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3755" title="NETIOC-respools-system-cli" src="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system-cli.png" alt="" width="620" height="135" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system-cli.png 775w, https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system-cli-300x65.png 300w" sizes="auto, (max-width: 620px) 100vw, 620px" /></a></p>
<p>The same information as we can see in the vSphere Client under <strong>System network resource pools</strong>.</p>
<p>Note that NetIOC is <strong>not enabled</strong> by default.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3758" title="NETIOC-respools-system" src="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system2.png" alt="" width="626" height="302" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system2.png 782w, https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-system2-300x145.png 300w" sizes="auto, (max-width: 626px) 100vw, 626px" /></a></p>
<p>Next we create a number of user-defined network resource pools.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">New-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool1&quot; -Description &quot;Dutch VMUG 2011&quot;
New-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool2&quot; -Description &quot;Dutch VMUG 2011&quot; -Shares 75 -QoSTag 3
New-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool3&quot; -Description &quot;Dutch VMUG 2011&quot; -Limit 4500
Get-dvSwNetworkResourcePool -dvSw $dvSw | ft -AutoSize</pre><p></p>
<p>The result shows the 3 newly created network resource pools.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3759" title="NETIOC-respools-user" src="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user.png" alt="" width="634" height="177" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user.png 793w, https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user-300x83.png 300w" sizes="auto, (max-width: 634px) 100vw, 634px" /></a></p>
<p>And we see the same in the vSphere Client.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user-VC.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3761" title="NETIOC-respools-user-VC" src="https://lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user-VC.png" alt="" width="630" height="342" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user-VC.png 788w, https://www.lucd.info/wp-content/uploads/2011/12/NETIOC-respools-user-VC-300x162.png 300w" sizes="auto, (max-width: 630px) 100vw, 630px" /></a></p>
<p>As we noticed earlier, NetIOC is not enabled by default. Let&#8217;s display the current setting.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-dvSwSIOC -dvSw $dvSw | ft -AutoSize</pre><p></p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NetIOC-disabled.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3760" title="NetIOC-disabled" src="https://lucd.info/wp-content/uploads/2011/12/NetIOC-disabled.png" alt="" width="306" height="66" srcset="https://www.lucd.info/wp-content/uploads/2011/12/NetIOC-disabled.png 383w, https://www.lucd.info/wp-content/uploads/2011/12/NetIOC-disabled-300x65.png 300w" sizes="auto, (max-width: 306px) 100vw, 306px" /></a></p>
<p>We change the setting and retrieve the value again</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Set-dvSwSIOC -dvSw $dvSw -Enabled
Get-dvSwSIOC -dvSw $dvSw | ft -AutoSize</pre><p></p>
<p>This gives</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/NetIOC-enabled.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3762" title="NetIOC-enabled" src="https://lucd.info/wp-content/uploads/2011/12/NetIOC-enabled.png" alt="" width="226" height="61" /></a></p>
<p>To conclude we will clean up the demo pools and disable NetIOC again.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Set-dvSwSIOC -dvSw $dvSw -Enabled:$false

Remove-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool1&quot;
Remove-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool2&quot;
Remove-dvSwNetworkResourcePool -dvSw $dvSw -Name &quot;NetPool3&quot;</pre><p></p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/12/15/vsphere-5-top-10-netioc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>vSphere 5 Top 10 – HA</title>
		<link>https://www.lucd.info/2011/12/13/vsphere-5-top-10-%e2%80%93-ha/</link>
					<comments>https://www.lucd.info/2011/12/13/vsphere-5-top-10-%e2%80%93-ha/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Tue, 13 Dec 2011 21:22:15 +0000</pubDate>
				<category><![CDATA[2011]]></category>
		<category><![CDATA[datastore]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[HA]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3715</guid>

					<description><![CDATA[The second post originating from our presentation at the Dutch VMUG Event 2011 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The second post originating from our presentation at the <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=section&amp;layout=blog&amp;id=5&amp;Itemid=55" target="_blank">Dutch VMUG Event 2011</a> is about HA. vSphere <strong>High Availability</strong> appeared in the 2nd place of the <strong>vSphere 5 features Top 10</strong>. For the HA feature we showed how you could find out the <strong>FDM</strong> master and slaves in your cluster, and how to find the <strong>heartbeat datastore</strong>.</p>
<p style="padding-left: 150px;"><a href="https://lucd.info/wp-content/uploads/2011/12/FDM.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3716" title="FDM" src="https://lucd.info/wp-content/uploads/2011/12/FDM.jpg" alt="" width="234" height="291" /></a></p>
<h2><span id="more-3715"></span>The FDM roles</h2>
<p>The following script will show,for each cluster node, which FDM role it holds.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Get-DasHostState{
  param(
  [PSObject]$Cluster
  )

  if($Cluster.GetType().Name -eq &quot;string&quot;){
    $Cluster = Get-Cluster -Name $Cluster
  }
  Get-View $cluster.ExtensionData.Host -Property Name,Runtime.DasHostState | %{
    New-Object PSObject -Property @{
      VMHost = $_.Name
      DasHostState = $_.RunTime.DasHostState.State
      StateReporter = (Get-View -Id $_.RunTime.DasHostState.StateReporter -Property Name).Name
    }
  }
}</pre><p></p>
<p>To call the function you can pass a clustername or the output of a Get-Cluster cmdlet. Something like this.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-DasHostState -Cluster Cluster1</pre><p></p>
<p>or this</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$clus = Get-Cluster -Name Cluster1
Get-DasHostState -Cluster $clus</pre><p></p>
<p>The output looks like this</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/HA-FDM-report.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3718" title="HA-FDM-report" src="https://lucd.info/wp-content/uploads/2011/12/HA-FDM-report.png" alt="" width="582" height="88" srcset="https://www.lucd.info/wp-content/uploads/2011/12/HA-FDM-report.png 727w, https://www.lucd.info/wp-content/uploads/2011/12/HA-FDM-report-300x45.png 300w" sizes="auto, (max-width: 582px) 100vw, 582px" /></a></p>
<p>Note that there are more <strong>DasHostState</strong> values, besides <strong>master</strong> and <strong>connectedToMaster</strong>, possible. The complete list can be found in the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.cluster.DasFdmAvailabilityState.html" target="_blank">ClusterDasFdmAvailabilityState</a> enumeration.</p>
<p>And you can of course provide this functionality as a New-VIProperty.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">New-VIProperty -Name &quot;DasHostState&quot; -ObjectType Cluster -Value {
  param($cluster)

  Get-View $cluster.ExtensionData.Host -Property Name,Runtime.DasHostState | %{
    New-Object PSObject -Property @{
      VMHost = $_.Name
      DasHostState = $_.RunTime.DasHostState.State
      StateReporter = (Get-View -Id $_.RunTime.DasHostState.StateReporter).Name
    }
  }
} -Force | Out-Null</pre><p></p>
<p>Now you can find the FDM states with a call like this</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Cluster -Name London | Select -ExpandProperty DasHostState</pre><p></p>
<p>The output will look exactly the same as the output that comes out of the Get-DasHostState function.</p>
<h2>The heartbeat datastore</h2>
<p>Another HA novelty in vSphere 5 is that it will now use, besides a network-based heartbeat, a datastore heartbeat, to check the presence of the nodes. To find out which of the shared datastores is used as the heartbeat datastore, you can use the following function.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Get-DasHostState{
  param(
  [PSObject]$Cluster
  )

  if($Cluster.GetType().Name -eq &quot;string&quot;){
    $Cluster = Get-Cluster -Name $Cluster
  }

  $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo()  | %{
    $_.HeartbeatDatastoreInfo | %{
      New-Object PSObject -Property @{
        Datastore = (Get-View -Id $_.Datastore).Name
        VMHosts = [string]::Join(',',($_.Hosts | %{(Get-View -Id $_).Name}))
      }
    }
  }
}</pre><p></p>
<p>The function can be called again with the name of a cluster or with the object returned by the Get-Cluster cmdlet.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-DasHostState -Cluster Cluster1</pre><p></p>
<p>The output looks something like this.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/HA-DS-report.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3727" title="HA-DS-report" src="https://lucd.info/wp-content/uploads/2011/12/HA-DS-report.png" alt="" width="452" height="62" srcset="https://www.lucd.info/wp-content/uploads/2011/12/HA-DS-report.png 565w, https://www.lucd.info/wp-content/uploads/2011/12/HA-DS-report-300x40.png 300w" sizes="auto, (max-width: 452px) 100vw, 452px" /></a></p>
<p>And of course, the same functionality as a New-VIProperty.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">New-VIProperty -Name HeartbeatDatastore -ObjectType Cluster -Value {
  param($cluster)

  $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | %{
    [String]::Join(',',($_.HeartbeatDatastoreInfo |
    %{(Get-View -Id $_.Datastore).Name}))
  }
} -Force | Out-Null</pre><p></p>
<p>You can now use the <strong>HeartbeatDatastore</strong> property to get the datastore that is used for the heartbeat.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Cluster -Name Cluster1 | Select Name, HeartbeatDatastore</pre><p></p>
<p>Which will result in</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/HA-DS-New-VIProperty-report.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3730" title="HA-DS-New-VIProperty-report" src="https://lucd.info/wp-content/uploads/2011/12/HA-DS-New-VIProperty-report.png" alt="" width="597" height="71" srcset="https://www.lucd.info/wp-content/uploads/2011/12/HA-DS-New-VIProperty-report.png 746w, https://www.lucd.info/wp-content/uploads/2011/12/HA-DS-New-VIProperty-report-300x35.png 300w" sizes="auto, (max-width: 597px) 100vw, 597px" /></a></p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/12/13/vsphere-5-top-10-%e2%80%93-ha/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>vSphere 5 Top 10 &#8211; Storage DRS</title>
		<link>https://www.lucd.info/2011/12/11/vsphere-5-top-10-storage-drs/</link>
					<comments>https://www.lucd.info/2011/12/11/vsphere-5-top-10-storage-drs/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Sun, 11 Dec 2011 22:59:02 +0000</pubDate>
				<category><![CDATA[2011]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[SDRS]]></category>
		<category><![CDATA[VMUG]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[Top-10]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3682</guid>

					<description><![CDATA[During our presentation at the Dutch VMUG Event 2011, Alan and myself showed [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>During our presentation at the <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=category&amp;layout=blog&amp;id=78&amp;Itemid=95" target="_blank">Dutch VMUG Event 2011</a>, <a href="https://twitter.com/#!/alanrenouf" target="_blank">Alan</a> and <a href="https://twitter.com/#!/LucD22" target="_blank">myself</a> showed how several entries of the <strong>Top 10 vSphere 5 Features</strong> session could be automated with the help of <a href="https://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli?view=overview" target="_blank">PowerCLI</a>. In the session we showed several demos.</p>
<p>This post is the first in a series, that will publish and document most of the scripts we used for the demos.</p>
<p>On the first position in the Top 10 we have <strong>Storage DRS</strong>. This feature brings intelligent placement of VMs and storage load balancing based on space usage and IO metrics. See <a href="https://blogs.vmware.com/vsphere/2011/07/vsphere-50-storage-features-part-5-storage-drs-initial-placement.html" target="_blank">part 4</a>, <a href="https://blogs.vmware.com/vsphere/2011/07/vsphere-50-storage-features-part-6-storage-drs-balance-on-space-usage.html" target="_blank">part 5</a> and <a href="https://blogs.vmware.com/vsphere/2011/07/vsphere-50-storage-features-part-5-storage-drs-balance-on-io-metrics.html" target="_blank">part 6</a> in <a href="https://twitter.com/#!/VMwareStorage" target="_blank">Cormac</a>&#8216;s excellent series on <a href="https://blogs.vmware.com/vsphere/2011/07/new-vsphere-50-storage-features-part-1-vmfs-5.html" target="_blank">vSphere 5 Storage Features</a>.</p>
<p><span id="more-3682"></span>In the current <a href="https://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli?view=overview" target="_blank">PowerCLI</a> version (5, build 435426) there is apparently only 1 cmdlet that works with Datastore Clusters, the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.powercli.cmdletref.doc_50/Get-DatastoreCluster.html" target="_blank">Get-DatastoreCluster</a> cmdlet. Unfortunately the cmdlet doesn&#8217;t seem to provide everything we came to expect from the regular PowerCLI objects. There is for example no <strong>ExtensionData</strong> property that would give us access to the server-side object for a Datastore Cluster.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-Get-DatastoreCluster.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3689" title="DSC-Get-DatastoreCluster" src="https://lucd.info/wp-content/uploads/2011/12/DSC-Get-DatastoreCluster.png" alt="" width="598" height="226" srcset="https://www.lucd.info/wp-content/uploads/2011/12/DSC-Get-DatastoreCluster.png 748w, https://www.lucd.info/wp-content/uploads/2011/12/DSC-Get-DatastoreCluster-300x113.png 300w" sizes="auto, (max-width: 598px) 100vw, 598px" /></a></p>
<p>The other basic actions (create, remove, configure) around Datastore Clusters are, for the time being, unfortunately missing from PowerCLI. And as you might have guessed, I felt the need to have some functions in my toolkit, that would allow me to do some basic stuff with Datastore Clusters.</p>
<h2>The functions</h2>
<p>Please note that the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/right-pane.html" target="_blank">VMware vSphere API Reference</a> refers to a <strong>Datastore Cluster</strong> as a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a>.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Set-DatastoreCluster{
&lt;#
.SYNOPSIS  Configure a DatastoreCluster
.DESCRIPTION The function is used to configure a
  DatastoreCluster. This includes the settings and
  the Datastores that are part of the cluster.
.NOTES  Author:  Luc Dekens
.PARAMETER Pod
  The StoragePod object. This can a name, an object
  returned by Get-DatastoreCluster or a StoragePod
  object.
.PARAMETER SDRSEnabled
  A switch to define is SDRS shall be enabled or not in
  the DatastoreCluster
.PARAMETER AutomationLevel
  Specifies the default SDRS behavior for virtual machines
  in the DatastoreCluster.
.PARAMETER IOMetric
  A switch whether or not SDRS takes into account storage
  I/O workload while calculating the recommendations
.PARAMETER SpaceUtilization
  When space utiixation exceeds this threshold, on one or
  more of the datastores in the DatastoreCluster, SDRS will
  generate migration recommendations.
.PARAMETER SpaceUtilizationDifference
  SDRS will generate migration recommendations when the space
  utilization difference between any of the datastores in the
  DatastoreCluster exceeds this threshold
.PARAMETER IOLatency
  When latency exceeds this threshold, on one or more of the
  datastores in the DatastoreCluster, SDRS will generate
  migration recommendations.
.PARAMETER IOLatencyDifference
  SDRS will generate migration recommendations when the IO
  latency difference between any of the datastores in the
  DatastoreCluster exceeds this threshold
.PARAMETER Interval
  The interval, in minutes, that SDRS runs to load balance
  among datastores within a DatastoreCluster 
.PARAMETER Datastore
  An array of datastores to add to the DatastoreCluster. The
  value can be a name or an object returned by Get-Datastore
.EXAMPLE
  PS&gt; Set-DatastoreCluster -Name DSC -SDRSEnabled:$false
.EXAMPLE
  PS&gt; Set-DatastoreCluster -Name DSC -IOLatency 25
.EXAMPLE
  PS&gt; Set-DatastoreCluster -Name DSC -Datastore $ds
#&gt;

param(
  [CmdletBinding()]
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [PSObject]$Pod,
  [switch]$SDRSEnabled,
  [ValidateSet(&quot;automated&quot;,&quot;manual&quot;)]
  [string]$AutomationLevel,
  [switch]$IOMetric,
  [ValidateRange(50,100)]
  [int]$SpaceUtilization,
  [ValidateRange(1,50)]
  [int]$SpaceUtilizationDifference,
  [ValidateRange(5,100)]
  [int]$IOLatency,
  [ValidateRange(1,100)]
  [int]$IOLatencyDifference,
  [ValidateRange(60,43200)]
  [int]$Interval,
  [PSObject]$Datastore
  )

  begin{
    $srm = Get-View StorageResourceManager
  }

  process{
    if($Pod.GetType().Name -eq &quot;string&quot;){
      $Pod = Get-StoragePod -Name $Pod
    }
    elseif($Pod.GetType().Name -eq &quot;DatastoreClusterImpl&quot;){
      $Pod = Get-StoragePod -Name $Pod.Name
    }
    if(!($PSCmdlet.MyInvocation.BoundParameters.Count -le 2 -and
    $PSCmdlet.MyInvocation.BoundParameters.ContainsKey(&quot;Datastore&quot;))){
      $spec = New-Object VMware.Vim.StorageDrsConfigSpec
      $spec.podConfigSpec = New-Object VMware.Vim.StorageDrsPodConfigSpec
      $spec.podConfigSpec.DefaultIntraVmAffinity = $true
      if($AutomationLevel){
        $spec.podConfigSpec.DefaultVmBehavior = $AutomationLevel
      }
      if($SDRSEnabled){
        $spec.podConfigSpec.Enabled = $SDRSEnabled
      }
      if($IOLatency -or $IOLatencyDifference){
        $spec.podConfigSpec.IoLoadBalanceConfig = New-Object VMware.Vim.StorageDrsIoLoadBalanceConfig
        if($IOLatency){
          $spec.podConfigSpec.IoLoadBalanceConfig.IoLatencyThreshold = $IOLatency
        }
        if($IOLatencyDifference){
          $spec.podConfigSpec.IoLoadBalanceConfig.IoLoadImbalanceThreshold = $IOLatencyDifference
        }
      }
      if($IOMetric){
        $spec.podConfigSpec.IoLoadBalanceEnabled = $IOMetric
      }
      if($Interval){
        $spec.podConfigSpec.loadBalanceInterval = $Interval
      }
      if($SpaceUtilizationDifference -or $SpaceUtilization){
        $spec.podConfigSpec.spaceLoadBalanceConfig = New-Object VMware.Vim.StorageDrsSpaceLoadBalanceConfig
        if($SpaceUtilizationDifference){
          $spec.podConfigSpec.spaceLoadBalanceConfig.MinSpaceUtilizationDifference = $SpaceUtilizationDifference
        }
        if($SpaceUtilization){
          $spec.podConfigSpec.spaceLoadBalanceConfig.SpaceUtilizationThreshold = $SpaceUtilization
        }
      }

      $srm.ConfigureStorageDrsForPod($Pod.MoRef, $spec, $true)
    }

    if($Datastore){
      $dsList = $Datastore | %{
        if($_.GetType().Name -eq &quot;string&quot;){
          (Get-Datastore -Name $_).ExtensionData.MoRef
        }
        else{$_.ExtensionData.MoRef}
      }
      $Pod.MoveIntoFolder($dsList)
    }
  }

  end{$Pod}
}

function New-DatastoreCluster{
&lt;#
.SYNOPSIS  Create a DatastoreCluster
.DESCRIPTION The function is used to configure a
  DatastoreCluster. This includes the settings and
  the Datastores that are part of the cluster.
.NOTES  Author:  Luc Dekens
.PARAMETER Name
  The name of the DatastoreCluster
.PARAMETER Folder
  The Folder where the DatastoreCluster shall be created.
.PARAMETER SDRSEnabled
  A switch to define is SDRS shall be enabled or not in
  the DatastoreCluster
.PARAMETER AutomationLevel
  Specifies the default SDRS behavior for virtual machines
  in the DatastoreCluster.
.PARAMETER IOMetric
  A switch whether or not SDRS takes into account storage
  I/O workload while calculating the recommendations
.PARAMETER SpaceUtilization
  When space utiixation exceeds this threshold, on one or
  more of the datastores in the DatastoreCluster, SDRS will
  generate migration recommendations.
.PARAMETER SpaceUtilizationDifference
  SDRS will generate migration recommendations when the space
  utilization difference between any of the datastores in the
  DatastoreCluster exceeds this threshold
.PARAMETER IOLatency
  When latency exceeds this threshold, on one or more of the
  datastores in the DatastoreCluster, SDRS will generate
  migration recommendations.
.PARAMETER IOLatencyDifference
  SDRS will generate migration recommendations when the IO
  latency difference between any of the datastores in the
  DatastoreCluster exceeds this threshold
.PARAMETER Interval
  The interval, in minutes, that SDRS runs to load balance
  among datastores within a DatastoreCluster 
.PARAMETER Datastore
  An array of datastores to add to the DatastoreCluster. The
  value can be a name or an object returned by Get-Datastore
.EXAMPLE
  PS&gt; New-DatastoreCluster -Name DSC -SDRSEnabled:$false
.EXAMPLE
  PS&gt; New-DatastoreCluster -Name DSC -IOLatency 25
.EXAMPLE
  PS&gt; New-DatastoreCluster -Name DSC -Datastore $ds
#&gt;

  param(
  [CmdletBinding()]
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [string]$Name,
  [parameter(Position = 1)]
  [PSObject]$Folder = &quot;datastore&quot;,
  [switch]$SDRSEnabled = $true,
  [ValidateSet(&quot;automated&quot;,&quot;manual&quot;)]
  [string]$AutomationLevel = &quot;automated&quot;,
  [switch]$IOMetric = $true,
  [ValidateRange(50,100)]
  [int]$SpaceUtilization = 80,
  [ValidateRange(1,50)]
  [int]$SpaceUtilizationDifference = 5,
  [ValidateRange(5,100)]
  [int]$IOLatency = 15,
  [ValidateRange(1,100)]
  [int]$IOLatencyDifference = 5,
  [ValidateRange(60,43200)]
  [int]$Interval = 480,
  [PSObject[]]$Datastore
  )

  begin{
    if($Folder.GetType().Name -eq &quot;string&quot;){
      $Folder = Get-Folder -Name $Folder
    }
  }

  process{
    $podMoRef = $Folder.ExtensionData.CreateStoragePod($Name)
    $Pod = Get-View -Id $podMoRef
    Set-DatastoreCluster -Pod $pod `
    -SDRSEnabled:$SDRSEnabled -AutomationLevel $AutomationLevel `
    -IOMetric:$IOMetric -SpaceUtilization $SpaceUtilization `
    -SpaceUtilizationDifference $SpaceUtilizationDifference `
    -IOLatency $IOLatency -IOLatencyDifference $IOLatencyDifference `
    -Interval $Interval
    if($Datastore){
      Set-DatastoreCluster -Pod $pod -Datastore $Datastore
    }
  }

  end{$Pod}
}

function Get-StoragePod{
&lt;#
.SYNOPSIS  Find a DatastoreCluster
.DESCRIPTION The function will return a StoragePod object.
  This is the server-side object used by vSphere for a
  DatastoreCluster.
.NOTES  Author:  Luc Dekens
.PARAMETER Name
  The name of the DatastoreCluster
.EXAMPLE
  PS&gt; Get-StoragePod
.EXAMPLE
  PS&gt; Get-StoragePod -Name &quot;SDC*&quot;
#&gt;

  param(
  [CmdletBinding()]
  [parameter(Position = 0, ValueFromPipeline = $true)]
  [string]$Name = &quot;*&quot;
  )

  begin{
   function Get-StoragePodInternal{
     param(
     [CmdletBinding()]
     [parameter(Mandatory = $true,ValueFromPipeline = $true)]
     [VMware.Vim.Folder]$Folder
     )

     $Folder.ChildEntity | %{
       if($_.Type -eq &quot;StoragePod&quot;){
         Get-View -Id $_
       }
       elseif($_.Type -eq &quot;Folder&quot;){
         Get-View -Id $_ | Get-StoragePodInternal
       }
     }
    }
  }
  
  process{
    Get-StoragePodInternal -Folder (Get-Folder -Name datastore).ExtensionData |
    where {$_.Name -like $Name}
  }
}

function Remove-DatastoreCluster{
&lt;#
.SYNOPSIS  Remove a DatastoreCluster
.DESCRIPTION The function will remove a DatastoreCluster.
.NOTES  Author:  Luc Dekens
.PARAMETER Name
  The DatastoreCluster to be removed.
  The parameter accepts a string, an object returned by the
  Get-DatastoreCluster cmdlet or a StoragePod object, returned
  by the Get-StoragePod function
.EXAMPLE
  PS&gt; Get-DatastoreCluster -Name &quot;SDC&quot; | Remove-DatastoreCluster
.EXAMPLE
  PS&gt; Remove-DatastoreCluster -Name $pod
#&gt;
  param(
  [CmdletBinding()]
  [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
  [PSObject]$Pod
  )

  process{
    if($Pod.GetType().Name -eq &quot;string&quot;){
      $Pod = Get-DatastoreCluster -Name $Pod
    }
    elseif($Pod.GetType().Name -eq &quot;DatastoreClusterImpl&quot;){
      $Pod = Get-StoragePod -Name $Pod.Name
    }

    $pod.Destroy()
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 73</strong>: To configure a DatastoreCluster we need the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StorageResourceManager.html" target="_blank">StorageResourceManager</a></p>
<p><strong>Line 76-82</strong>: A kind of Object By Name logic. This will allow the function to access the Pod parameter as a Name in a string, or as an object returned by the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.powercli.cmdletref.doc_50/Get-DatastoreCluster.html" target="_blank">Get-DatastoreCluster</a> cmdlet or as a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a> object.</p>
<p><strong>Line 83-84</strong>: The Set-DatastoreCluster function can be used to change settings of the DatastoreCluster but also to add Datastores to the DatastoreCluster. To avoid calling the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StorageResourceManager.html#configureStorageDrsForPod" target="_blank">ConfigureStorageDrsForPod</a> method when no settings have to be changed, these lines check if only the Datastore parameter was passed.</p>
<p><strong>Line 85-119</strong>: These lines set up the parameters for the call to the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StorageResourceManager.html#configureStorageDrsForPod" target="_blank">ConfigureStorageDrsForPod</a> method. Since the script calls this method in &#8216;incremetal&#8217; mode, we only set the properties in the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.storageDrs.ConfigSpec.html" target="_blank">StorageDrsConfigSpec</a> object that are actually set. Hence all the tests in this part of the code.</p>
<p><strong>Line 122-130</strong>: This part of the function adds the Datastores to the DatastoreCluster with the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.Folder.html#moveInto" target="_blank">MoveIntoFolder</a> method.</p>
<p><strong>Line 133</strong>: Since we want to use the functions in pipeline constructs, the function places the DatastoreCluster in the pipeline as a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a> object.</p>
<p><strong>Line 186-207</strong>: Note that the New-DatastoreCluster function uses all the defaults that are defined in the description of the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.storageDrs.ConfigSpec.html" target="_blank">StorageDrsConfigSpec</a> object in the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/right-pane.html" target="_blank">VMware vSphere API Reference</a></p>
<p><strong>Line 209-213</strong>: The Object By Name functionality for the Folder parameter.</p>
<p><strong>Line 216</strong>: The creation of the DatastoreCluster through the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.Folder.html#createStoragePod" target="_blank">CreateStoragePod</a> method.</p>
<p><strong>Line 218-223</strong>: The function calls the Set-DatastoreCluster function.</p>
<p><strong>Line 224-226</strong>: When the call passed Datastores, these are added to the DatastoreCluster through a 2nd call to the Set-DatastoreCluster function.</p>
<p><strong>Line 229</strong>: Since we want to use the functions in pipeline constructs, the function places the DatastoreCluster in the pipeline as a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a> object.</p>
<p><strong>Line 232-276</strong>: Normally you don&#8217;t need to use this function since there is already the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.powercli.cmdletref.doc_50/Get-DatastoreCluster.html" target="_blank">Get-DatastoreCluster</a> cmdlet in PowerCLI. This function returns a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a> object and is primarily for internal use. An exception could be when you want to report on properties in your DatastoreCluster that are not in the object returned by the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.powercli.cmdletref.doc_50/Get-DatastoreCluster.html" target="_blank">Get-DatastoreCluster</a> cmdlet.</p>
<p><strong>Line 254-269</strong>: The function uses a local function called GetStoragePodInternal in order to recursively traverse the vSphere tree.</p>
<p><strong>Line 274</strong>: When the function is called with a specific Name, this Where-clause will filter out the desired StoragePod objects.</p>
<p><strong>Line 300-305</strong>: A kind of Object By Name logic. This will allow the function to access the Pod parameter as a Name in a string, or as an object returned by the <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.powercli.cmdletref.doc_50/Get-DatastoreCluster.html" target="_blank">Get-DatastoreCluster</a> cmdlet or as a <a href="https://pubs.vmware.com/vsphere-50/topic/com.vmware.wssdk.apiref.doc_50/vim.StoragePod.html" target="_blank">StoragePod</a> object.</p>
<h2>Sample use</h2>
<p>The following samples will show you how you can use these functions to set up, configure and remove a DatastoreCluster.</p>
<p>In my testlab I have set up the following simple environment to demonstrate the functions. It consists of 3 VMFS5 datastores that I want to use to create a DatastoreCluster.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-Initial.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3699" title="DSC-Initial" src="https://lucd.info/wp-content/uploads/2011/12/DSC-Initial.png" alt="" width="164" height="114" /></a></p>
<p>First we will create a DatastoreCluster, called <strong>DSC</strong>, with 2 datastores, <strong>DS2 and DS3</strong>. The code to do that looks as follows.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">New-DatastoreCluster -Name DSC -Datastore DS2,DS3</pre><p></p>
<p>The result looks like this</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-create-DSC.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3700" title="DSC-create-DSC" src="https://lucd.info/wp-content/uploads/2011/12/DSC-create-DSC.png" alt="" width="162" height="125" /></a></p>
<p>Since we didn&#8217;t specify any parameters, besides the datastores, for the DatastoreCluster, the DatastoreCluster took all the defaults. As a guide, this is a table showing the defaults as used in the New-DatastoreCluster function.</p>
<table border="0">
<tbody>
<tr>
<td>Folder</td>
<td>datastore</td>
</tr>
<tr>
<td>AutomationLevel</td>
<td>automatic</td>
</tr>
<tr>
<td> IOMetric</td>
<td>True</td>
</tr>
<tr>
<td> SpaceUtilization</td>
<td> 80%</td>
</tr>
<tr>
<td> SpaceUtilizationDifference</td>
<td> 5%</td>
</tr>
<tr>
<td>IOLatency</td>
<td> 15</td>
</tr>
<tr>
<td>IOLatencyDifference</td>
<td> 5</td>
</tr>
<tr>
<td>Interval</td>
<td> 480</td>
</tr>
</tbody>
</table>
<p>Now we want to add the Datastore DS4 to this DatastoreCluster.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-StoragePod -Name DSC |
Set-DatastoreCluster -Datastore (Get-Datastore -Name DS4)</pre><p></p>
<p>The result.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-add-DS.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3706" title="DSC-add-DS" src="https://lucd.info/wp-content/uploads/2011/12/DSC-add-DS.png" alt="" width="206" height="134" /></a></p>
<p>As a guide to understand which parameter that corresponds with which property, I made the following screenshots.</p>
<p>The <strong>General</strong> option.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-param-General.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3707" title="DSC-param-General" src="https://lucd.info/wp-content/uploads/2011/12/DSC-param-General.png" alt="" width="570" height="216" srcset="https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-General.png 712w, https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-General-300x113.png 300w" sizes="auto, (max-width: 570px) 100vw, 570px" /></a></p>
<p>The <strong>SDRS Automation</strong> option</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-param-Automation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3708" title="DSC-param-Automation" src="https://lucd.info/wp-content/uploads/2011/12/DSC-param-Automation.png" alt="" width="582" height="174" srcset="https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-Automation.png 727w, https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-Automation-300x89.png 300w" sizes="auto, (max-width: 582px) 100vw, 582px" /></a></p>
<p>The <strong>SDRS Runtime</strong> options</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/12/DSC-param-Runtime.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3709" title="DSC-param-Runtime" src="https://lucd.info/wp-content/uploads/2011/12/DSC-param-Runtime.png" alt="" width="579" height="458" srcset="https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-Runtime.png 724w, https://www.lucd.info/wp-content/uploads/2011/12/DSC-param-Runtime-300x237.png 300w" sizes="auto, (max-width: 579px) 100vw, 579px" /></a></p>
<p>The other settings are currently not implemented in the functions.</p>
<p>The supported parameters can all be changed with the Set-DatastoreCluster function. Something like this for example.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-StoragePod -Name &quot;DSC&quot; |
Set-DatastoreCluster -Interval 240 -SpaceUtilization 70</pre><p></p>
<p>This call changes the SDRS interval to 240 minutes or 4 hours (instead of the default 8 hours). And it changes the Utilized Space threshold to 70% (instead of the default 80%).<br />
To remove a DatastoreCluster, you can do</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-StoragePod -Name &quot;DSC&quot; | Remove-DatastoreCluster</pre><p></p>
<p>Enjoy the functions !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/12/11/vsphere-5-top-10-storage-drs/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Dutch VMUG event 2009 &#8211; The (nearly) lost tapes</title>
		<link>https://www.lucd.info/2009/12/12/dutch-vmug-event-2009-the-nearly-lost-tapes/</link>
					<comments>https://www.lucd.info/2009/12/12/dutch-vmug-event-2009-the-nearly-lost-tapes/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Sat, 12 Dec 2009 18:08:45 +0000</pubDate>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[2009]]></category>
		<category><![CDATA[Dutch]]></category>
		<category><![CDATA[VMUG]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=1158</guid>

					<description><![CDATA[During my Dutch VMUG event 2009 presentation there was a technical problem with [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>During my <a href="https://vmug.nl/cms/index.php?option=com_content&amp;view=article&amp;id=87&amp;Itemid=55" target="_blank" rel="noopener noreferrer">Dutch VMUG event 2009</a> presentation there was a technical problem with some of the demo videos I prepared. Luckily an audience member came to the rescue by downloading the excellent <a href="https://www.videolan.org/vlc/" target="_blank" rel="noopener noreferrer">VLC Video Player</a> via his cell phone. Thanks again for the assistance  <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>To make up for this technical mishap, the demo videos with a short explanation.</p>
<p><span id="more-1158"></span></p>
<h2>Demo 1</h2>
<p>In this video I wanted to show how you can use <a href="https://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit?view=overview" target="_blank" rel="noopener noreferrer">PowerCLI</a>&#8216;s <strong>Web Service Access</strong> cmdlets (<strong>Get-View</strong> and <strong>Get-ViObjectByViView</strong>) to go from automation objects to and from SDK objects.</p>
[vimeo clip_id="8135753"]
<h2>Demo 2</h2>
<p>The 2nd demo shows how to find your way around in the SDK objects.</p>
<p>It also showcases the two scripts from Dutch VMUG event 2009 &#8211; handy scripts.</p>
[vimeo clip_id="8137987"]
<h2>Demo 3</h2>
<p>A sample debugging session in <a href="https://www.idera.com/Products/PowerShell/PowerShell-Plus/" target="_blank" rel="noopener noreferrer">PowerShell Plus</a>.</p>
<p>Shows how to set a breakpoint and investigate the properties of SDK objects.</p>
[vimeo clip_id="8138271"]
<h2>Demo 4</h2>
<p>A sample workflow created with PowerWF Studio.</p>
<p>The workflow is executed <strong>interactively</strong> and then it is used to build a <strong>snapin</strong>.</p>
[vimeo clip_id="8138404"]
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2009/12/12/dutch-vmug-event-2009-the-nearly-lost-tapes/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
