Get-ESXiMemoryDimms


I had to get some info about host memory dimms layout, so i wrote this one.
It is utilizing CIM_PhysicalMemory. Not sure if i haven’t written it before, but i couldn’t find it on my disk so…
Here it is.

Function Get-ESXiMemoryDimms {
<#
    .SYNOPSIS
        Returns memory dimms configuration for esxi
  
    .DESCRIPTION
        This function utilizes wsman / cim in order to download configuration of memory dims in ESXi.
  
    .PARAMETER  esxi
        Specify esxi host for which you want to get the report
          
    .PARAMETER  rootpw
        Password for user root inside esxi
 
    .EXAMPLE
        PS C:\> Get-ESXiMemoryDimms -Esxi 'Esxi048.domain.local' -rootpw 'password.123' | ft *
        BankLabel               Manufacturer Description SizeGB MemoryType MemoryDef
        ---------               ------------ ----------- ------ ---------- ---------
        P0_Node0_Channel0_Dimm0 Samsung      P1-DIMMA1       16 24         DDR3
        P0_Node0_Channel0_Dimm1 Samsung      P1-DIMMA2       16 24         DDR3
        P0_Node0_Channel1_Dimm0 Samsung      P1-DIMMB1       16 24         DDR3
        P0_Node0_Channel1_Dimm1 Samsung      P1-DIMMB2       16 24         DDR3
        P0_Node0_Channel2_Dimm0 Samsung      P1-DIMMC1       16 24         DDR3
        P1_Node1_Channel2_Dimm0 Samsung      P2-DIMMG1       16 24         DDR3
        P1_Node1_Channel2_Dimm1 Samsung      P2-DIMMG2       16 24         DDR3
        P1_Node1_Channel3_Dimm0 Samsung      P2-DIMMH1       16 24         DDR3
        P1_Node1_Channel3_Dimm1 Samsung      P2-DIMMH2       16 24         DDR3
                                Winbond                  ...625 11         Flash
         

    .NOTES
        NAME:  Get-ESXiMemoryDimms
          
        AUTHOR: Grzegorz Kulikowski
          
        NOT WORKING ? #powercli @ irc.freenode.net 
          
    .LINK
  
https://psvmware.wordpress.com
  
#>
param([String]$Esxi,[string]$rootpw)

#MemoryTypes from: https://msdn.microsoft.com/en-us/library/aa394347(v=vs.85).aspx
$MemHash = @{
'0'='Unknown';
'1'='Other';
'2'='DRAM';
'3'='Synchronous DRAM';
'4'='Cache DRAM';
'5'='EDO';
'6'='EDRAM';
'7'='VRAM';
'8'='SRAM';
'9'='RAM';
'10'='ROM';
'11'='Flash';
'12'='EEPROM';
'13'='FEPROM';
'14'='EPROM';
'15'='CDRAM';
'16'='3DRAM';
'17'='SDRAM';
'18'='SGRAM';
'19'='RDRAM';
'20'='DDR';
'21'='DDR2';
'22'='DDR2 FB-DIMM';
'23'='DDR2 FB-DIMM';
'24'='DDR3';
'25'='FBD2'
}
$pwd = ConvertTo-SecureString $rootpw -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential (“root”, $pwd)
$CIMOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 –UseSsl
$Session = New-CimSession -Authentication Basic -Credential $cred -ComputerName $esxi -port 443 -SessionOption $CIMOpt
Get-CimInstance -CimSession $Session CIM_PhysicalMemory | select BankLabel, Manufacturer, Description , @{n='SizeGB';e={$_.Capacity/1GB}}, MemoryType, @{n='MemoryDef';e={$MemHash[$_.MemoryType]}}
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s