Citrix XenDesktop 5.5–Change Memory Size for Machine Catalog

I have several machine catalogs that are currently using up too much memory. The only way to change the memory size in the machine catalog is via Powershell SDK from the desktop controller, and the only way to change the memory size of existing VMs is by modifying the actual VM memory settings from the virtual host.

Objective of this project

Change a the machine catalog memory size from 2gb to 1.5gb. This will take care of any new VMs that will be added to the machine catalog. Change all existing VMs in the catalog via VMware PowerCLI.

Changing Machine Catalog Memory Size

From the XenDesktop controller, open up a PowerShell cmd and  use:
> Get-ProvScheme
to obtain the catalog names. Once you find the machine catalog name you want to work on. Catalog mame is usually under “ProvisioningSchemeName”. Use the provisioningschemename parameter to make sure that you are listing the correct machines.

> Get-ProvScheme –ProvisioningSchemeName “catalog name”

To display all the details of selected machine catalog.

image

To set change the memory size or any other property use the Set-ProvScheme

> Set-ProvScheme –ProvisioningSchemeName “catalog name” –VMMemoryMB “new size”

> Use the Get-ProvScheme  command to check the new size.

image

At this point the memory size for the catalog should be up to date. I would test creating a new machine to make sure that everything is looking good. Double check by pulling up the VM settings.

image

First part is done. Next..

Change Existing VM Memory settings using PowerCLI

For this step you will need vSphere PowerCLI loaded on your machine and a user account with sufficient privileged to make changes to machines via cmd.

Start by installing vSphere PowerCLI if you haven’t done so.

Once completed, launch PowerCLI and connect to VMHost.

image

>Connect-VISerser “VMware host server name”

Find the VMs in questions using Get-VM –Name “VM Name” (to list multiple VMS use wildcard use as many characters as possible to narrow down the list). You can use the the XenDesktop Naming Scheme for the catalog and replace the numbers with the “*”, they look like vmname##

> Get-VM –Name “vmname*’       

image

This will display the list of all VMs that start with that name. We still have to narrow it down to machines with 2GB only and they have to be powered off. If the machines are not powered off yet. Set it in maintenance mode and powered it down.

Pipe the MemoryMB property to the previous command.

> Get-VM –Name “vmname*’  | where { $_.MemoryMB –eq “2056”}

image

Now that we know that this string is giving the correct output we are ready to make the changes using Set-VM. The following command with set the new size and skip confirmation.

> Get-VM –Name “vmname*’ | where { $_.MemoryMB –eq “2056”} | Set-VM –MemoryMB 1500 –Confirm: $false

image

After the script completes it will display the new size. You can be as creative as you want when writing these scripts just make sure to test before making real changes.

 

Here is a good reference link to get started with PowerCLI commands:

Getting Started with PowerCLI 4.1 – Automating Your vSphere Environment

Post a Comment

0 Comments