Citrix App Layering: Mass Edit of VMX Advanced Settings

Citrix App Layering: Mass Edit of VMX Advanced Settings

book

Article ID: CTX226142

calendar_today

Updated On:

Description

Introduction

Sometimes there are special settings that Unidesk customers must add to their desktop VMX files based on recommendations by VMware. This script was developed in order to ease the administrative burden of this requirement. The script can also set memory or CPU reservations, as these are often requested.

A separate script has been published that allows the updates to be run during the desktops setup process. See https://support.citrix.com/article/CTX226120.

 

 


 

Where to download ?

Certain legacy Citrix tools are now available on request only. Please submit the request here - https://forms.gle/obA39PEz5qpDiSPq8

Once we verify your request, we will provide access to the download location. 

 


Prerequisites

  • VMware PowerCLI 5.5 Update 2 or later
  • Windows 7 or above

The script has several components. There is a simple application to setup the script variables and a few PowerShell scripts.


Setting Up the Script

The first thing you must do to use the utility is to download and install the VMware PowerCLI software onto your broker machine. This link will take you to the download page at the time this document was written: https://communities.vmware.com/community/vmtn/automationtools/powercli?ei=CkKQT6yUM_Kd6AGvj-GlBA&usg=AFQjCNHixkgPGjBKVx5ZnJKrGXx0ba-y_g.

Installation of the utility is simple. Create a folder in a path with no spaces. For example c:\updatevmxauto. (Unfortunately spaces make it hard to include in a cmd file if you want to schedule a task to run regularly.)

Next, unpack the source zip file into this directory. Before unpacking, check the properties of the zip file to see if they may be blocked as shown in the screenshot below. If they are, click unblock. This will unblock all of the files as long as you unblock the zip before you extract the files.

file

Once unpacked there is an application called UpdateVMX40.exe and UpdateVMX40.hta. Double-click this application and the following screen will open.

file

To configure the script, enter your vCenter credentials and save them. This will create a file in the source directory called cred.xml as shown here. The password is encrypted based on the logged in user and the desktop and cannot be moved to another machine or used by another login. Therefore if you choose to run the backup as a scheduled task you must be logged on as the user you will define to run the scheduled task on the machine that you will run the scheduled task when you create the cred file.

When saved, a file called settings.txt is also created in the config directory and it holds the vCenter name and the vCenter account.

In this section you define the settings to add or change in the VMX file. I have included the two current settings asked for most by customers as of publication. Keep these or delete them as necessary.

  • add:devices.hotplug:false
  • add:mks.poll.headlessRates:1000 100 2

To add a value just fill in the key and value fields and click “AddVMXValue” To remove an entry check the box and click “Remove Checked”.

 

Memory and CPU Reservations

To modify Memory or CPU reservations for the desktop use the following strings as keys with their associated value

  • CpuReservationMhz
  • MemReservationMB

If you are only changing reservations the desktop does not need to be shut down because that is not required.

 

Selection Area

The first task to selecting desktops to update is to run the “GetVMs” script. This will query the vCenter and return a list of all the virtual machines on the vCenter server. It takes about 2 seconds per VM to do the search but you only have to run it again if you have added new machines you need to update.

After obtaining the VM list you can now search for systems to update. The search is on the name file and supports wildcard searches with an “*”. For example: to find all machines whose name begins with “vdi-acc-“ the filter would be “vdi-acc- *”.

The search also provides the ability to search for systems that have not had the current settings applied. If you check the box for “Filter for Missing Key Values” then each system returned by the name search will be examined to see if it is already in compliance with the vmx changes. Only systems that do not have the VMS Key\Value pairs already set will be returned. Note however that this check adds time to the search.

After search for desktops select the desired set and click “Save”. This will copy the selected machines to the “Action Area”. You can do multiple selections and use the append checkbox to add machines to the “Action Area”.

When you have selected all the desired machines make sure they are all Shutdown, then run the update. The shutdown is required to modify a VMX file. It is not required to update CPU or Memory Reservations.


Log Files

Search Logs

  • When a filtered search is utilized, the utility will create a folder with the date and time of the search under the vmlogs folder. Each desktop found that requires updating will have a file in this folder that contains the settings that require updating. An example is shown here.

Update Logs

  • When the update script runs, if it finds desktops to process it will create a log on the log folder of the script directory. 
  • The logs will contain a summary of changes by machine and any errors encountered.
file

Additional Information

 


 

Where to download ?

Certain legacy Citrix tools are now available on request only. Please submit the request here - https://forms.gle/obA39PEz5qpDiSPq8

Once we verify your request, we will provide access to the download location.