<?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>PeetersOnline &#187; CPU</title>
	<atom:link href="http://www.peetersonline.nl/index.php/tag/cpu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peetersonline.nl</link>
	<description>Using Powershell for (virtually) everything!</description>
	<lastBuildDate>Fri, 19 Aug 2011 09:22:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Calculate vSphere 5 Licenses with Powershell (UPDATED)</title>
		<link>http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 09:41:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerCLI 4.0]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[Licensing]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=484</guid>
		<description><![CDATA[VMware has announced the next generation of vSphere yesterday. Besides lots of new features, vSphere 5 also comes with a new licensing structure. For every licensed physical CPU, you get a certain amount of vRAM, which you will be able to allocate to virtual machine. Only the running VM&#8217;s will count towards your license limit. <a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vmware.com/" target='_blank'>VMware</a> has announced the next generation of <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> yesterday. Besides lots of new features, <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> 5 also comes with a new licensing structure. For every licensed physical CPU, you get a certain amount of vRAM, which you will be able to allocate to virtual machine. Only the running VM&#8217;s will count towards your license limit.<br />
Curious how the <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> 5 licensing model will impact your license cost? Want to know how many <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> 5 liceses you will need? The following script calculates exactly how many licenses you need for the different editions and how much overhead you will have left.</p>
<p>UPDATE 04-AUG-2011: <a href="http://www.vmware.com/" target='_blank'>vmware</a> has increased vRAM entitlements for all editions of <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> 5! I have updated the script (shown below and the attached script). The screenshot is still the old one. Please read the <a href="http://www.vmware.com/files/pdf/vsphere_pricing.pdf" target="_blank">new Licensing PDF here</a> for all the details.</p>
<p>NOTE: Please note that I add up all your pCpu’s, ignoring current license types. I also add up all your current vRAM usage (RAM assigned to powered on VM’s). I then show you different scenarios if you purchase license type x for ALL your pCpu’s. If your environment consists of a mix of <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> editions, check out <a href="http://www.virtu-al.net/2011/08/03/vsphere-5-license-entitlement-changes/" target="_blank">Alan Renouf&#8217;s script</a> to analyse your environment.</p>
<p><a href="http://www.peetersonline.nl/wp-content/Vsp5.jpg"><img src="http://www.peetersonline.nl/wp-content/Vsp5.jpg" alt="" title="Vsp5" width="767" height="209" class="alignnone size-full wp-image-489" /></a><br />
 <span id="more-484"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$vCenterServerName</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;MyVC1.domain.local&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;myVC2.domain.local&quot;</span> <span style="color: #008000;"># Enter your vCenter server name here. In case of multiple vCenter servers, separate using a comma.</span>
&nbsp;
<span style="color: #000080;">$ErrorActionPreference</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Stop&quot;</span>
&nbsp;
<span style="color: #008000;"># Connect to vCenter(s)</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Connecting...&quot;</span>
<span style="color: #800080;">$VC</span> <span style="color: pink;">=</span> Connect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$vCenterServerName</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Counting physical cpu's and vRAM in your environment. Please be patient...&quot;</span>
<span style="color: #008000;"># Gather information</span>
<span style="color: #800080;">$pCpu</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>VMHost <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>View <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> <span style="color: #008080; font-style: italic;">-ExpandProperty</span> Hardware <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> <span style="color: #008080; font-style: italic;">-ExpandProperty</span> CpuInfo <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> <span style="color: #008080; font-style: italic;">-Property</span> NumCpuPackages <span style="color: #008080; font-style: italic;">-Sum</span><span style="color: #000000;">&#41;</span>.Sum
<span style="color: #800080;">$vRAM</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Round<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>VM <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.PowerState <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;PoweredOn&quot;</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> <span style="color: #008080; font-style: italic;">-Property</span> MemoryMB <span style="color: #008080; font-style: italic;">-Sum</span><span style="color: #000000;">&#41;</span>.Sum<span style="color: pink;">/</span><span style="color: #804000;">1024</span><span style="color: pink;">,</span><span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;======&quot;</span>
<span style="color: #800000;">&quot;pCpu Count: {0}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$pCpu</span>
<span style="color: #800000;">&quot;vRAM (GB):  {0}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$vRAM</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;======&quot;</span>
<span style="color: #008000;"># Disconnect</span>
Disconnect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$vCenterServerName</span> <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$false</span>
&nbsp;
<span style="color: #008000;"># Calculate required licenses</span>
<span style="color: #800080;">$licCol</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$licObj</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> Edition<span style="color: pink;">,</span> Entitlement<span style="color: pink;">,</span> Licenses
<span style="color: #800080;">$licObj</span>.Edition <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Essentials/Essentials Plus/Standard&quot;</span>
<span style="color: #800080;">$licObj</span>.Entitlement <span style="color: pink;">=</span> <span style="color: #800000;">&quot;1 pCpu + 32 GB vRAM&quot;</span>
<span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">32</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} pCpu overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">32</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">32</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">Else</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} GB vRAM overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$pCpu</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #804000;">32</span> <span style="color: pink;">*</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$vRAM</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$licCol</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$licObj</span>
<span style="color: #800080;">$licObj</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> Edition<span style="color: pink;">,</span> Entitlement<span style="color: pink;">,</span> Licenses
<span style="color: #800080;">$licObj</span>.Edition <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Enterprise&quot;</span>
<span style="color: #800080;">$licObj</span>.Entitlement <span style="color: pink;">=</span> <span style="color: #800000;">&quot;1 pCpu + 64 GB vRAM&quot;</span>
<span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">64</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} pCpu overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">64</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">64</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">Else</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} GB vRAM overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$pCpu</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #804000;">64</span> <span style="color: pink;">*</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$vRAM</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$licCol</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$licObj</span>
<span style="color: #800080;">$licObj</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> Edition<span style="color: pink;">,</span> Entitlement<span style="color: pink;">,</span> Licenses
<span style="color: #800080;">$licObj</span>.Edition <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Enterprise Plus&quot;</span>
<span style="color: #800080;">$licObj</span>.Entitlement <span style="color: pink;">=</span> <span style="color: #800000;">&quot;1 pCpu + 96 GB vRAM&quot;</span>
<span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">96</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} pCpu overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">96</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$vRAM</span><span style="color: pink;">/</span><span style="color: #804000;">96</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">Else</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$licObj</span>.Licenses <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0} with {1} GB vRAM overhead&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$pCpu</span><span style="color: pink;">,</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #804000;">96</span> <span style="color: pink;">*</span> <span style="color: #800080;">$pCpu</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">-</span> <span style="color: #800080;">$vRAM</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$licCol</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$licObj</span>
<span style="color: #008000;"># Displaying output</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Resulting license options:&quot;</span>
<span style="color: #800080;">$licCol</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;======&quot;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;NOTE: vRAM only counts memory allocated to vm's that are POWERED ON.&quot;</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Red 
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;NOTE: Please double check the results of this script, since hosts may have been omitted due to errors.&quot;</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Red 
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Disclaimer: No rights can be deduced from this calculation.&quot;</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Red
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;======&quot;</span></pre></div></div>

<p>You can download the script here (rename to .ps1): <a href='http://www.peetersonline.nl/wp-content/Get-vSphere5LicensesUpdated.txt'>Get-vSphere5LicensesUpdated</a></p>
<p>Don’t forget to use <a href="http://communities.vmware.com/community/developer/windows_toolkit" target='_blank'>PowerCLI</a> to run the script, or add the <a href="http://communities.vmware.com/community/developer/windows_toolkit" target='_blank'>PowerCLI</a> snapin to your <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a> session (Add-PSSnapIn <a href="http://www.vmware.com/" target='_blank'>vmware</a>*).</p>
<p>Enjoy!</p>
<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>Examine VMware CPU Ready Times with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/vmware/examine-vmware-cpu-ready-times-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/examine-vmware-cpu-ready-times-with-powershell/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 13:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerCLI 4.0]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Stat]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=398</guid>
		<description><![CDATA[When your (VMware) consolidation ratios are becoming high, it might be smart to keep an eye on your vm&#8217;s CPU Ready Times. Unfortunately, by default, the VI Client will only show realtime ready time statistics. Plus you&#8217;d have to look at each vm individually. Thank God VMware for the PowerCLI! Read this document for more <a href='http://www.peetersonline.nl/index.php/vmware/examine-vmware-cpu-ready-times-with-powershell/'>[...]</a>
Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When your (<a href="http://www.vmware.com/" target='_blank'>VMware</a>) consolidation ratios are becoming high, it might be smart to keep an eye on your vm&#8217;s CPU Ready Times. Unfortunately, by default, the VI Client will only show realtime ready time statistics. Plus you&#8217;d have to look at each vm individually. Thank <del datetime="2009-06-12T13:20:49+00:00">God</del> <a href="http://www.vmware.com/" target='_blank'>VMware</a> for the <a href="http://communities.vmware.com/community/developer/windows_toolkit" target='_blank'>PowerCLI</a>! Read <a href="http://viops.vmware.com/home/docs/DOC-1404.pdf;jsessionid=C2335915887A860FD97EA727CDC5DC15">this document </a>for more information on how to interpret the results.</p>
<p><span id="more-398"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># Variables</span>
<span style="color: #800080;">$OutFile</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;D:\Scripts\ReadyTimes.csv&quot;</span>
<span style="color: #800080;">$VIServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;MyVIServer.domain.local&quot;</span>
&nbsp;
<span style="color: #008000;"># Connect to Virtual Center</span>
<span style="color: #800080;">$VI</span> <span style="color: pink;">=</span> Connect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$VIServer</span>
&nbsp;
<span style="color: #800080;">$myCol</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #0000FF;">ForEach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$VMHost</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>VMHost <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Sort</span> Name<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #0000FF;">ForEach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$VM</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$VMHost</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>VM <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Sort</span> Name<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
		<span style="color: #008000;"># Gather Stats</span>
		<span style="color: #800080;">$Ready</span> <span style="color: pink;">=</span> <span style="color: #800080;">$VM</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>Stat <span style="color: pink;">-</span>Stat Cpu.Ready.Summation <span style="color: pink;">-</span>RealTime
		<span style="color: #800080;">$Used</span> <span style="color: pink;">=</span> <span style="color: #800080;">$VM</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>Stat <span style="color: pink;">-</span>Stat Cpu.Used.Summation <span style="color: pink;">-</span>RealTime
		<span style="color: #800080;">$Wait</span> <span style="color: pink;">=</span> <span style="color: #800080;">$VM</span> <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>Stat <span style="color: pink;">-</span>Stat Cpu.Wait.Summation <span style="color: pink;">-</span>RealTime
		<span style="color: #0000FF;">For</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$a</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$a</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$VM</span>.NumCpu; <span style="color: #800080;">$a</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$myObj</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> VMHost<span style="color: pink;">,</span> VM<span style="color: pink;">,</span> Instance<span style="color: pink;">,</span> <span style="color: pink;">%</span>RDY<span style="color: pink;">,</span> <span style="color: pink;">%</span>USED<span style="color: pink;">,</span> <span style="color: pink;">%</span>WAIT
			<span style="color: #800080;">$myObj</span>.VMHost <span style="color: pink;">=</span> <span style="color: #800080;">$VMHost</span>.Name
			<span style="color: #800080;">$myObj</span>.VM <span style="color: pink;">=</span> <span style="color: #800080;">$VM</span>.Name
			<span style="color: #800080;">$myObj</span>.Instance <span style="color: pink;">=</span> <span style="color: #800080;">$a</span>
			<span style="color: #800080;">$myObj</span>.<span style="color: #800000;">&quot;%RDY&quot;</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Round<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$Ready</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Instance <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$a</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> <span style="color: #008080; font-style: italic;">-Property</span> Value <span style="color: #008080; font-style: italic;">-Average</span><span style="color: #000000;">&#41;</span>.Average<span style="color: #000000;">&#41;</span><span style="color: pink;">/</span><span style="color: #804000;">200</span><span style="color: pink;">,</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$myObj</span>.<span style="color: #800000;">&quot;%USED&quot;</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Round<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$Used</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Instance <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$a</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> <span style="color: #008080; font-style: italic;">-Property</span> Value <span style="color: #008080; font-style: italic;">-Average</span><span style="color: #000000;">&#41;</span>.Average<span style="color: #000000;">&#41;</span><span style="color: pink;">/</span><span style="color: #804000;">200</span><span style="color: pink;">,</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$myObj</span>.<span style="color: #800000;">&quot;%WAIT&quot;</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Round<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$Wait</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Instance <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$a</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> <span style="color: #008080; font-style: italic;">-Property</span> Value <span style="color: #008080; font-style: italic;">-Average</span><span style="color: #000000;">&#41;</span>.Average<span style="color: #000000;">&#41;</span><span style="color: pink;">/</span><span style="color: #804000;">200</span><span style="color: pink;">,</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$myCol</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$myObj</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #008080; font-weight: bold;">Clear-Variable</span> Ready <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue 
		<span style="color: #008080; font-weight: bold;">Clear-Variable</span> Wait <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue 
		<span style="color: #008080; font-weight: bold;">Clear-Variable</span> Used <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue 
		<span style="color: #008080; font-weight: bold;">Clear-Variable</span> myObj <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
Disconnect<span style="color: pink;">-</span>VIServer <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$false</span>
&nbsp;
<span style="color: #008000;"># Export and launch output</span>
<span style="color: #800080;">$myCol</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Export-Csv</span> <span style="color: #800080;">$OutFile</span>
<span style="color: #008080; font-weight: bold;">Invoke-Item</span> $OutFile</pre></div></div>

<p>Related posts:<ol>
<li><a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/' rel='bookmark' title='Remove vmware memory limits with Powershell'>Remove vmware memory limits with Powershell</a></li>
<li><a href='http://www.peetersonline.nl/index.php/vmware/calculate-vsphere-5-licenses-with-powershell/' rel='bookmark' title='Calculate vSphere 5 Licenses with Powershell (UPDATED)'>Calculate vSphere 5 Licenses with Powershell (UPDATED)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/vmware/examine-vmware-cpu-ready-times-with-powershell/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

