Optimizing Windows 7 for FlexCast Delivery

Posted on 2010/01/15


Introduction

With the release of XenDesktop 4, Windows 7 is now a supported operating system for XenDesktop. Since Microsoft announced the end-of-life for Windows XP many institutions are considering moving their user population to Windows 7.

Microsoft has built Windows 7 as a virtualization-aware operating systems and as such it is already optimized for such an environment. However, my initial investigation has yielded the following performance optimizations that can be further applied to Windows 7 when deploying it via XenDesktop (XD) and/or Provisioning Services (PVS). Of course, as in the original Windows XP Optimization blog, none of the optimizations below are required, but they can be used if you want to streamline your Windows 7 desktop delivery. Used for this blog was Windows 7 Enterprise Edition.

Installing Windows 7

This may be obvious, but when creating the virtual hard disk (VHD) to store the Windows 7 image, use the Windows 7 Diskpart utility, not the Windows XP/2003 version. In other words, do not create the VHD from a Windows Server 2003 host and then install Windows 7 on it. The Windows XP/2003 version of Diskpart places a disk signature to the beginning of the disk and then starts the partition in the last few sectors, guaranteeing that the file system blocks will be out of alignment with the underlying storage system. Normally, I always set the offset to 1024K (1MB) because that offset will align with most storage devices.

Removable Windows 7 Features

Once you have installed Windows 7 into the VHD, you will find many new features. Windows 7 with its media-rich focus does install a couple of features that can be removed before taking an image if the users will be accessing Windows 7 through XenDesktop. Here are the features I saw installed with Windows 7 Enterprise that can most likely be uninstalled in the XenDesktop environment.

  • Windows Media Center: XenDesktop users are unlikely to be watching TV on their desktop.
  • Windows DVD Maker: Most users will not be creating DVDs through their XenDesktop.
  • Tablet PC Components: Users of XenDesktop are not likely to be using a tablet PC for connectivity.

Please note that if you are reviewing these optimizations to use FlexCast technologies to deliver locally streamed desktops, you may want to leave these features engaged, since users could be doing any of those tasks listed above.

Run the XenConvert Optimizer

The quickest way of optimizing Windows 7 is to use the optimizer that comes with XenConvert. The XenConvert Optimizer tool will automatically set the correct values on a Windows 7 operating system for many of the items that I had included in the previous Windows XP blog. The optimize button can be found on the following screen in XenConvert:

XenConvert Optimizer

XenConvert Optimizer Tool

Once you click the button, you are presented with a box that allows you to deselect the optimizations that are not required in your environment. Items that are labeled “Vista” work on “Windows 7” as well. The screenshot below shows the optimizations available from the tool:

PVS Image Optimizer

Image Optimizer Tool

Hint: The Optimizer can be manually executed outside of XenConvert by running C:\Program Files\Citrix\Provisioning Services\TargetOSOptimizer.exe.

Unfortunately, the optimizations usually upset the Windows Security system because it disables Windows Update. After optimizing, the Action Center will now show a message with an error. To stop the message, go to the Action Center and disable security messages for Windows Update and any other services that you have other software to support. For instance, in my environment I am using McAfee Security for the other options, so I have stopped the warning messages from appearing in Action Center.

Windows 7 Action Center

Windows 7 Action Center

Settings for the Default User Profile

This section lists a few of the settings that will improve the user experience but are set at the user profile level. Keep in mind that creating a default user profile in Windows 7 is quite a bit more complex than in previous versions of Windows. I have provided guidance around how to modify the default user profile at the end of this section, but you might want consider applying these changes through Active Directory Group Policy.

Force Offscreen Compositing for Internet Explorer

This setting is disabled by default in Windows 7 with Internet Explorer 8 and is still recommended for XenDesktop 4. Turning this setting off removes any of the flickering that may display when using Internet Explorer through XenDesktop, by telling Internet Explore to fully render the page prior to displaying it. To change it, complete the following steps:

1. Open Internet Explorer
2. Select Tools >> Internet Options from the menu
3. Select the Advanced tab
4. In the Browsing section, enable the checkbox for “Force offscreen compositing even under Terminal Services
5. Click OK to save the changes
6. Restart Internet Explorer

More information available here.

Remove the Menu Delay

With Windows 7, the Start menu has a built-in delay of 400 milliseconds. To speed the menu response time, follow these steps to remove the delay:

1. Start the Registry Editor (Regedit.exe)
2. Navigate to HKEY_CURRENT_USER\Control Panel\Desktop{color}
3. Set the value of MenuShowDelay to a lower value, say 100
4. Exit the Registry Editor

Remove Unnecessary Visual Effects

Windows 7 Performance Options

Windows 7 Visual Effects Options


Disabling unnecessary visual effects such as menu animations and shadow effects that generally just slow down the response time of the desktop. Keep in mind that right now XenDesktop 4 with Windows 7 doesn’t support the Aero effects for now.

1. Open Control Panel
2. Select the System applet
3. Click Advanced System Settings on the left
4. Click the Settings button under the Performance section
5. Click “Adjust for best performance” radio button
6. If you want to keep the ClearType font settings, enable the “Smooth edges on screen fonts” checkbox
7. If you want to keep the XP Visual Style, scroll to the bottom and check the last box titled “Use visual styles on windows and buttons
8. Click OK twice to close the dialogs and then exit the System Properties screen

Power Button Action Default

Power Button Action

Set the Default Behavior for the Power Button

When using XenDesktop 4, setting the default behavior to “Log off” will be the best action. Users can still select other available options, but this selection will probably make the most sense and allow the Desktop Group settings to control whether the virtual workstation reboots or not at logoff. To change the default setting, complete the following steps.

1. Right-click the Taskbar or Start button
2. Click Properties
3. Select the Start Menu tab
4. Select the appropriate action under Power button action:
5. Click OK to save the default action

Make the User Profile the Default User Profile

Since the changes above apply to every user, the quickest way to apply them for all users logging onto the workstation is to set them in the default user profile. In Windows XP you could copy the profile over to the default user, however in Windows 7 the “Copy To” button has been disabled for every profile except the Default User (the one you are most likely to replace). Instead now with Windows 7 there is only one method of replacing the default user profile, which is to use the “CopyProfile” function of Sysprep. If you don’t know how to do this, (and I did not want to learn it) you might want to check out the following Microsoft Support article, “How to customize default user profiles in Windows 7“. For those readers wanting a bit more background as to the changes and options available, you can check out the Deployment Guys blog.

Not wanting to “sysprep” my Windows 7 golden image, I went looking for an easier solution. I found it. I used the Forensit User Profile Manager 1.6 Vista tool. This is a free tool (at least right now) and it replaces the Windows 7 profile management dialog with their own which will allow you to copy over the default profile. When you remove it, (which I did so the vDisk users will not be able to manage profiles) the default behavior returns and you cannot choose the “Copy To” any more.

NOTE: As before, be sure to remove any user or machine specific data for the ICA Client, the ICA Streaming Client, Password Manager, and EdgeSight before copying the profile over. Since the image prep for these items is beyond the scope of this blog, I will save it for a topic another day.

Settings for the Machine

This section provides a list of the optimizations that will affect all users of the image. These settings are usually set after logging in as an administrator. Several of the optimizations from the Windows XP blog are handled when using the XenConvert Optimize tool mentioned at the beginning of the blog. This section represents the remaining ones.

Power Configuration Settings

Power Options Dialog

Power Options Dialog

Two of the power settings can adversely affect the performance of Provisioning Services. One of them is the hard disk power savings. If the PVS server is using a local hard disk for the vDisk cache, you do not want the operating system to power down the local drive. The other setting is the Hibernate setting. The PVS Optimizer tool will disable hibernating, but you can manually do it as well. Here are the steps for disabling the power settings:

1. Open Control Panel
2. Select the Power Options applet
3. Click Change Plan Settings
4. Click Change Advanced power settings
5. For the default power scheme, set “Turn off hard disks after” setting to Never
6. You may want to repeat this procedure for the other power plans
7. Click OK to save the changes
8. Exit the Power Options applet

Modify the Windows Service Timeout

With Windows 7, the possibility still exists that in environments with large amounts of virtual machines rebooting simultaneously that Virtual Desktop Agent (VDA) may fail to register because the Windows Service timeout is reached before Citrix Desktop Service starts. I recommend changing the 30-second default to 120-seconds to give the service plenty of time to start before the Citrix Desktop Service starts.

1. Start Registry Editor (Regedit.exe)
2. Navigate to the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
3. If the ServicesPipeTimeout value is not present, use the following steps to create it:
a. Click the Control
b. On the Edit menu, point to New, and then click DWORD Value
c. Type ServicesPipeTimeout, and then press Enter
4. Right-click the ServicesPipeTimeout key and then click Modify
5. Click Decimal
6. Type 120000, and then click OK (120-seconds in milliseconds)
7. Quit the Registry Editor
8. Reboot for the changes to take effect

Disable Remaining Unnecessary Services

You can go through the list of other services that are configured on Windows 7 and disable any ones that will not be used in your environment. One nice thing about Windows 7 is that some of the more critical services will explain in the description what will not work if the service is disabled. Here are few services that you may be able to disable:

Function Discovery Resource Publication: Publishes this computer and resources attached to this computer so they can be discovered over the network. If this service is stopped, network resources will no longer be published and they will not be discovered by other computers on the network. If the device will not be sharing any resources, you can safely disable this service.

Background Intelligent Transfer Service: Transfers files in the background using idle network bandwidth. If the service is disabled, then any applications that depend on BITS, such as Windows update or MSN Explorer, will be unable to automatically download programs and other information. In most instances this service can be disabled safely since auto-updating features are disabled for standard (read-only) vDisks.

Desktop Windows Manager Session Manager: Provides Desktop Window Manager startup and maintenance services. Basically, it is used or Aero and other special effects, like transparency and glass window frames, 3-D window transition animations and Windows Flip. If you are following the guidelines above to reduce most of the special effects, or the video card drivers on the host does not support Aero, you can safely disable this service.

Theme Service: Provides user experience theme management. As above, if you are following the guidelines above to reduce most of the special effects this is a prime candidate for being disabled.

Offline Files: The offline files service performs maintenance activities on the offline files cache, responds to user logon and logoff events, implements the internals of the public API, and dispatches interesting events to those interested in offline files activities and changes in cache state. Since most XenDesktops will be running in a data center remotely, the need for offline files and synchronization is not present.

Most of the other services are not set to automatic startup in the Enterprise edition, so I didn’t bother reviewing them.

Final Recommendations

Here are few final recommendations, two of which are carry-overs from the Windows XP optimization blog that I believe still apply for Windows 7.

Flush the DNS cache

Although I have not had any issues with Windows 7 and ip address caching, I am leaving this recommendation in the list because it will not hurt anything and it only takes 10 seconds to complete. Flush the DNS Cache using the ipconfig /flushdns command. This prevents any IP addresses cached on the read-only disk from interfering with DNS resolution at a later date.

Run ChkDsk

This recommendation is a good idea since it verifies the file system or disk has no missing file links. Run chkdsk -f from a command prompt and verify that no issues are present.

Re-enable Windows Security Center

The XenConvert process seems to disable the Windows Security Center service resulting in yet another message in the Action Center. Unfortunately, I was unable to find any way to disable that message. So my current solution was to just re-enable Security Center after XenConvert disabled it during the image creation process and leave all the other warning messages disabled as mentioned at the beginning.

Wrapping it up

I realize that Windows 7 is a new operating system and as I learn more about its behavior, I will try to get that information out here on my blog. Of course comments are welcome if readers have optimization ideas that they have tried with Windows 7 and either XenDesktop or Provisioning Services.

If you found this blog useful and would like to be notified of future blogs, please feel free to follow me on Twitter @pwilson98.

Cross-post

Advertisements