PowerCLI: Find and Set the Service Console Memory value


image

Last year I wrote a blog post about changing the COS memory. You can find the post here: https://ict-freak.nl/2008/11/26/vmware-service-console-memory/ (it’s written in Dutch). In that post there is already a one-liner made by LucD butt in this post you’ll get an extra one-liner to determine the COS memory value.

If you want to see how much memory is allocated for the Service Console run the next script:

Get-VMHost | Sort Name | Get-View | Select Name, `
@{N="Service Console Memory";E= {"" + `
[math]::round($_.Config.ConsoleReservation.ServiceConsoleReserved / 1MB, 0) + " MB "}}

 

Just add | Export-Csv -NoTypeInformation "D:\cosmem.csv" to export the data to a CSV file.

The output will look like this:

image

The script/one-liner:

Get-VMHost | Get-View | % { 
$_.Name | Where { $_.Config.ConsoleReservation.ServiceConsoleReserved -eq "314572800" }
(Get-View -Id $_.ConfigManager.MemoryManager).ReconfigureServiceConsoleReservation(800*1mb) }
 

You can monitor the changes in vCenter:

image 

More information about the maximum values can be found here:  vsp_40_config_max.pdf.

The maximum value for the COS Memory is 800MB so that’s what the script will use to set the COS memory.

Note: You have to restart the server to apply the changes.

Advertisements

4 thoughts on “PowerCLI: Find and Set the Service Console Memory value

  1. laez

    The maximum memory value of the COS in ESX 3.5 was 768MB.

    I know it’s not much less than 800MB, but I’m not sure it has changed in vSphere 4 to 800MB or that it’s actually still 768MB.

    Reply
    1. afokkema Post author

      I just checked the vi3_35_25_u2_config_max.pdf document. In this document they hold on to the same value as in the vSphere document.

  2. Matt.B

    I modified the value to 737148928 for 703 MB which some of my hosts are set to. I ran your script and it kicked off a set service console memory reservation job for every host including ones already set to 800 MB. I copied your script straight into PowerGui. I noticed this is pretty much the same script in the VMware Community Power Pack and that script has the same structure. Does the script properly skip hosts that do not have the value you specify?

    Reply

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