<?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; vSphere</title>
	<atom:link href="http://www.peetersonline.nl/index.php/tag/vsphere/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>Remove vmware memory limits with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 09:21:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerCLI 4.0]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Limits]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=477</guid>
		<description><![CDATA[Using Memory Limits in vmware vSphere can cause severe performance issues. The guest operating system assumes it can use all of the allocated memory, but vSphere will make sure the vm cannot use more than the memory limit. It does this by inflating a memory balloon using the balloon driver included with the vmware tools. <a href='http://www.peetersonline.nl/index.php/vmware/remove-vmware-memory-limits-with-powershell/'>[...]</a>
Related posts:<ol>
<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>Using Memory Limits in <a href="http://www.vmware.com/" target='_blank'>vmware</a> <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> can cause severe performance issues. The guest operating system assumes it can use all of the allocated memory, but <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> will make sure the vm cannot use more than the memory limit. It does this by inflating a memory balloon using the balloon driver included with the <a href="http://www.vmware.com/" target='_blank'>vmware</a> tools. The performance chart in the <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> Client will show the virtual machine is ballooning. I never recommend using memory limits in <a href="http://www.vmware.com/" target='_blank'>vmware</a>.<br />
The following script will remove all memory limits in your <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> infrastructure, preventing the problems described above.<span id="more-477"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$vCenterServer</span> <span style="color: pink;">=</span> MyvCenterServer.domain.local <span style="color: #008000;">#Enter your vCenter server FQDN here</span>
&nbsp;
<span style="color: #008000;">#Connect to vCenter Server</span>
<span style="color: #800080;">$VC</span> <span style="color: pink;">=</span> Connect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$vCenterServer</span>
&nbsp;
<span style="color: #008000;">#Gathering data</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> get<span style="color: pink;">-</span>vm<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$vmView</span> <span style="color: pink;">=</span> <span style="color: #800080;">$vm</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>view
&nbsp;
	<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;VM: $($vm.Name)&quot;</span>
	<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Current Limit: $($vmView.config.MemoryAllocation.Limit)&quot;</span>
&nbsp;
	<span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$vmView</span>.config.MemoryAllocation.Limit <span style="color: #FF0000;">-ne</span> <span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008000;">#Preparing modified data</span>
		<span style="color: #800080;">$spec</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> VMware.Vim.VirtualMachineConfigSpec
		<span style="color: #800080;">$MemoryAllocation</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> VMware.Vim.ResourceAllocationInfo
		<span style="color: #800080;">$MemoryAllocation</span>.Limit <span style="color: pink;">=</span> <span style="color: pink;">-</span><span style="color: #804000;">1</span>
		<span style="color: #800080;">$spec</span>.MemoryAllocation <span style="color: pink;">=</span> <span style="color: #800080;">$MemoryAllocation</span>
&nbsp;
		<span style="color: #008000;">#Applying modification</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Removing Memory Limit&quot;</span>
		<span style="color: #800080;">$vmView</span>.ReconfigVM<span style="color: #000000;">&#40;</span><span style="color: #800080;">$spec</span><span style="color: #000000;">&#41;</span>
&nbsp;
		<span style="color: #008000;">#Reloading data</span>
		<span style="color: #800080;">$vm</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>vm <span style="color: #800080;">$vm</span>.name
		<span style="color: #800080;">$vmView</span> <span style="color: pink;">=</span> <span style="color: #800080;">$vm</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>view
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Current Limit: $($vmView.config.MemoryAllocation.Limit)&quot;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008000;">#Cleanup</span>
	<span style="color: #008080; font-weight: bold;">Clear-Variable</span> vmView <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">#Disconnect</span>
Disconnect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$vCenterServer</span> <span style="color: #008080; font-style: italic;">-Confirm</span>:$false</pre></div></div>

<p>You can download the script here (rename to .ps1): <a href='http://www.peetersonline.nl/wp-content/Remove-MemoryLimits.txt'>Remove-MemoryLimits</a></p>
<p>Don&#8217;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/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/remove-vmware-memory-limits-with-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Report vSphere Alarms with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/vmware/report-vsphere-alarms-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/vmware/report-vsphere-alarms-with-powershell/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 10:58:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerCLI 4.0]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VI Toolkit 1.5]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Alarms]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=418</guid>
		<description><![CDATA[Wow, vSphere vCenter Server has a lot of new alarms! Great for monitoring your environment. But a pain when it comes to documenting it. Thank God VMware for the PowerCLI! Just a few lines of code can do the documentation for you. Here&#8217;s how: # Report vSphere Alarms # by Hugo Peeters # www.peetersonline.nl &#160; <a href='http://www.peetersonline.nl/index.php/vmware/report-vsphere-alarms-with-powershell/'>[...]</a>
Related posts:<ol>
<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>
<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>Wow, <a href="http://www.vmware.com/products/vsphere/" target='_blank'>vSphere</a> vCenter Server has a lot of new alarms! Great for monitoring your environment. But a pain when it comes to documenting it. Thank <del datetime="2009-10-30T10:54:17+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>! Just a few lines of code can do the documentation for you.</p>
<p>Here&#8217;s how:</p>
<p><span id="more-418"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># Report vSphere Alarms</span>
<span style="color: #008000;"># by Hugo Peeters</span>
<span style="color: #008000;"># www.peetersonline.nl</span>
&nbsp;
<span style="color: #008000;">#Region Variables</span>
<span style="color: #800080;">$VCServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;myVCServer&quot;</span>
<span style="color: #800080;">$Outfile</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;D:\scripts\Alarms.txt&quot;</span>
&nbsp;
Connect<span style="color: pink;">-</span>VIServer <span style="color: #800080;">$VCServer</span>
<span style="color: #800080;">$SI</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>View ServiceInstance
<span style="color: #800080;">$AM</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>View <span style="color: #800080;">$SI</span>.Content.AlarmManager
<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;">$Folder</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>Folder<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;">$Alarm</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$AM</span>.GetAlarm<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$Folder</span><span style="color: pink;">|</span>Get<span style="color: pink;">-</span>View<span style="color: #000000;">&#41;</span>.MoRef<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
		<span style="color: #800080;">$Alarm</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>View <span style="color: #800080;">$Alarm</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> Folder<span style="color: pink;">,</span> Name<span style="color: pink;">,</span> Description<span style="color: pink;">,</span> Enabled<span style="color: pink;">,</span> Summary
		<span style="color: #800080;">$myObj</span>.Folder <span style="color: pink;">=</span> <span style="color: #800080;">$Folder</span>.Name
		<span style="color: #800080;">$myObj</span>.Name <span style="color: pink;">=</span> <span style="color: #800080;">$Alarm</span>.Info.Name
		<span style="color: #800080;">$myObj</span>.Description <span style="color: pink;">=</span> <span style="color: #800080;">$Alarm</span>.Info.Description
		<span style="color: #800080;">$myObj</span>.Enabled <span style="color: pink;">=</span> <span style="color: #800080;">$Alarm</span>.Info.Enabled
		<span style="color: #800080;">$myObj</span>.Summary <span style="color: pink;">=</span> <span style="color: #800080;">$Alarm</span>.Info.Expression.Expression <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Out-String</span>
		<span style="color: #800080;">$myObj</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: #000000;">&#125;</span>
<span style="color: #800080;">$myCol</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Enabled<span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Out<span style="color: #FF0000;">-File</span></span> <span style="color: #800080;">$Outfile</span>
<span style="color: #008080; font-weight: bold;">ii</span> $Outfile</pre></div></div>

<p>Related posts:<ol>
<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>
<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/report-vsphere-alarms-with-powershell/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

