<?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>vRAM Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/tag/vram/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/tag/vram/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Thu, 04 Aug 2011 06:36:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.11</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>vRAM Archives - LucD notes</title>
	<link>https://www.lucd.info/tag/vram/</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>Query vRAM</title>
		<link>https://www.lucd.info/2011/07/13/query-vram/</link>
					<comments>https://www.lucd.info/2011/07/13/query-vram/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 13 Jul 2011 09:53:55 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[vRAM]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[license]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3407</guid>

					<description><![CDATA[After the Cloud Infrastructure Launch Forum event from July 12th 2011, it seemed [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>After the <strong>Cloud Infrastructure Launch Forum</strong> event from July 12th 2011, it seemed that the new <strong>licensing model</strong> attracted more blog posts and tweets than the 140 new features in vSphere 5.</p>
<p>As one could imagine, one of the most heard questions was, what will I need to pay in the new licensing model. As a pro-active measure, I decided to write a short script that would tell me what vRAM entitlement my current vSphere 4 licenses would offer me.</p>
<p><span style="background-color: #ffffff;"><strong><span style="background-color: #ffff99;"><strong>Update August 4th 2011 08:30</strong></span>:</strong> VMware updated the vRAM calculation specifications. See the <a href="https://www.vmware.com/files/pdf/vsphere_pricing.pdf" target="_blank">VMware vSphere<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 5.0 Licensing, Pricing and Packaging White Paper</a>.<br />
</span></p>
<p><span style="background-color: #ffff00;"><strong>Update July 13th 2011 14:45</strong></span>: Apparently you have a vRAM pool per license type. I updated the script.</p>
<h2><span id="more-3407"></span>The script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Get-vRAMInfo{
  $memoryCapMB = 96 * 1KB
  $vRAMtab = @{
    &quot;esxEssentials&quot;=32;
    &quot;esxEssentialsPlus&quot;=32;
    &quot;esxFull&quot;=32;
    &quot;esxAdvanced&quot;=32;
    &quot;esxEnterprise&quot;=64;
    &quot;esxEnterprisePlus&quot;=96
  }

  $licMgr = Get-View LicenseManager
  $licAssignMgr = Get-View $licMgr.LicenseAssignmentManager

  $totals = @{}

  Get-VMHost | %{
    $lic = $licAssignMgr.QueryAssignedLicenses($_.Extensiondata.MoRef.Value)
    $licType = $lic[0].AssignedLicense.EditionKey
    $totalvRAM = ($vRAMtab[$licType] * $_.Extensiondata.Hardware.CpuInfo.NumCpuPackages)

    $VMs = Get-VM -Location $_
    $vmRAMConfigured = ($VMs | `
    Select -Property @{N=&quot;CappedMemoryMB&quot;;
      E={if($_.MemoryMB -lt $memoryCapMB){$_.MemoryMB}else{$memoryCapMB}}} | `
      Measure-Object -Property CappedMemoryMB -Sum).Sum/1KB
    $vmRAMUsed = ($VMs | where {$_.PowerState -eq &quot;PoweredOn&quot;} | `
      Select -Property @{N=&quot;CappedMemoryMB&quot;;
      E={if($_.MemoryMB -lt $memoryCapMB){$_.MemoryMB}else{$memoryCapMB}}} | `
      Measure-Object -Property CappedMemoryMB -Sum).Sum/1KB

    if($totals.ContainsKey($licType)){
      $totals[$licType].vRAMEntitled += $totalvRAM
      $totals[$licType].vRAMConfigured += $vmRAMConfigured
      $totals[$licType].vRAMUsed += $vmRAMUsed
    }
    else{
      $totals[$licType] = New-Object PSObject -Property @{
        vCenter = $defaultVIServer.Name
        LicenseType = $lic[0].AssignedLicense.Name
        vRAMEntitled = $totalvRAM
        vRAMConfigured = $vmRAMConfigured
        vRAMUsed = $vmRAMUsed
      }
    }
  }
  $totals.GetEnumerator() | %{
    New-Object PSObject -Property @{
      vCenter = $_.Value.vCenter
      LicenseType = $_.Value.LicenseType
      vRAMEntitled = $_.Value.vRAMEntitled
      vRAMConfigured = [Math]::Round($_.Value.vRAMConfigured,1)
      vRAMUsed = [Math]::Round($_.Value.vRAMUsed,1)
    }
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 3-7</strong>:  The vRAM entitlement per type of license is stored in a hash tab.<br />
<strong></strong></p>
<p><strong>Line 6</strong>: The script doesn&#8217;t take into account that the Advanced licenses will be converted to Enterprise.</p>
<p><strong>Line 16</strong>: <span style="background-color: #ffff00;"><strong>Note</strong></span>, the current version of the script only uses <strong>allocated licenses</strong> to calculate your vRAM entitlement. If you happen to have <strong>unallocated licenses</strong>, they will currently not be reflected in your vRAM entitlement.</p>
<p><strong>Line 17</strong>: The script uses the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.LicenseAssignmentManager.html#queryAssignedLicenses" target="_blank">QueryAssignedLicenses</a> method. Unfortunately this only works for <span style="background-color: #ffff00;">vSphere 4.1 and higher</span>.</p>
<p><strong>Line 22</strong>: Calculate the amount of configured RAM for the guests. This will give the potential maximum vRAM you could need.<strong></strong></p>
<p><strong>Line 23</strong>: Calculate the amount of RAM used by powered on guests</p>
<h2>Sample run</h2>
<p>Just call the function: <strong>Get-vRAMInfo</strong>.</p>
<p>It will produce something like this.</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/07/vRAM22.png"><img decoding="async" class="alignnone size-full wp-image-3423" title="vRAM2" src="https://lucd.info/wp-content/uploads/2011/07/vRAM22.png" alt="" width="614" height="59" srcset="https://www.lucd.info/wp-content/uploads/2011/07/vRAM22.png 614w, https://www.lucd.info/wp-content/uploads/2011/07/vRAM22-300x28.png 300w" sizes="(max-width: 614px) 100vw, 614px" /></a></p>
<p>If your <strong>vRAMUsed</strong> amount turns out to be higher than your <strong>vRAMEntitled</strong> amount, you will have to acquire extra licenses.</p>
<p>In my test environment I don&#8217;t need additional licenses <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f606.png" alt="😆" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/07/13/query-vram/feed/</wfw:commentRss>
			<slash:comments>47</slash:comments>
		
		
			</item>
	</channel>
</rss>
