Shannon Ma Virtualized

A Spotlight on Virtualization, IT, and the Business of Software

Cloning a XenApp Server with XenAppPrep

with 42 comments

One of my side projects these past couple of months has been XenAppPrep – a tool that will help our customers clone their XenApp servers. It’s basically the equivalent of sysprep for Windows, except we’re doing it for XenApp. Before taking an image of a XenApp server, a handful of steps must be done to generalize the XenApp installation, which will remove the machine-specific information from your XenApp install.

In the past, our customers either had to perform this manually or use a set of scripts Matt Bator and Pete Downing, my fellow coworkers from the Provisioning Server Team, had created. The XenAppPrep tool does this all for you and will be released as a small MSI, which was written in WiX. It contains a command-line tool and Windows service that were both created in C#, so you’ll need the .NET Framework 2.0 installed. With XenAppPrep, you can easily clone your XenApp server via the following steps:

  1. Setup the XenApp server that will be cloned with all of the apps and settings that you’d like in your image.
  2. Install XenAppPrep.
  3. Run the XenAppPrep command-line tool. This tool removes all of the machine-specific information from the XenApp install. If you plan on rolling out this image via Provisioning Server, you can use the /pvs switch.
  4. Run any other generalization tools you would normally run (e.g. sysprep).
  5. Capture an image of the server.
  6. Push out the image to all servers that will be part of your farm.

When your clones come online, the XenAppPrep service will kick in, reset all of your machine-specific information, and kick off the XenApp services such as IMA. This all gets done pretty quickly too. After that, your clone will work just like a freshly installed XenApp server. If you ran the tool with the /pvs switch, the XenAppPrep service will always run when the machine starts. Otherwise, the service will only run on the first bootup and disable itself after.

Here’s a screenshot of the command-line tool running against Delaware (aka XenApp 5.0):

This tool will work on both physical and virtual machines, so you could easily setup your farm on physical machines (e.g. with Provisioning Server or Altiris) or virtual machines with XenServer. Even better, you could deploy your XenApp servers with Provisioning Server to virtual machines! With this type of infrastructure, you can easily bring up new XenApp servers on the fly. Imagine having some automation that detects when the farm is overloaded, brings a new XenApp server online, and everything goes back to normal… maybe Workflow Studio could help us out here. Wow, that sounds pretty geeky!

We plan on releasing this initial version as a web download in the near future with support for XenApp 4.0 to 5.0. I’ll post a link to the web download here once we go live, so if you’d like to be notified go ahead and subscribe to my blog. We’d like to include this on the XenApp media and possibly see how it can integrate with the XenApp installer (so you have an option to clone the server at the end of install), but this wont be happening in Delaware and is more of a long-term item.

Much thanks to Matt Bator for his help with testing this tool in addition to Pete Downing and Ashish Gujarathi for collecting the requirements and feedback from the field. Well, it is 2 AM here in Fort Lauderdale so I better get going. Feel free to drop me a comment if you’d like, I’d love to hear any and all feedback.

Written by shannonma

July 8, 2008 at 6:15 am

42 Responses

Subscribe to comments with RSS.

  1. Dear Shannon,

    We had the same idea :) Actually I’ve worked a lot with PVS 4.5 and found some missing things in the vbs that could lead to WMI errors when the servers will go into production. This is also the case when using this script to do for example a VM Template. I’ve found solutions and am writting a service and a GUI App to help with it but as you started building something I think this could be very useful to exchange about it.

    Best Regards,

    Pierre

    Pierre Marmignon

    July 9, 2008 at 9:12 pm

  2. The manual way works (http://support.citrix.com/article/CTX107406) but does take some time. Looking forward to your automated solution!

    Andy

    July 10, 2008 at 2:40 pm

  3. Sounds Awesome! I have a customer who would love this! please let me know when it becomes available!

    Faisal Iqbal

    July 12, 2008 at 4:43 am

  4. Hi,

    This sounds like a really great tool, and one I have been looking for, for some time. Does this tool work on both X86 and X64 platforms?

    We are currenlty nearling the completion of our builds for a Presentation Server 4.5 Rollout, this tool could be very timely? Are you any nearer to release or is it possible to help test a pre-release version?

    Great work!

    Cheers

    Janason

    Janson Ragon

    July 17, 2008 at 10:01 am

  5. Thanks for the feedback Janson. This tool does work on 32-bit and 64-bit platforms. We’re tentatively scheduled to release it as a download on 28-July. I’ll post a link here once it goes live.

    shannonma

    July 17, 2008 at 1:04 pm

  6. Sorry to be so dense, but your posting says that to be notified when the new cloning tool is ready, subscribe to this blog….but I find no plave that looks lie I can subscribe.

    -RM

    Robert Morris

    July 20, 2008 at 1:55 pm

  7. You can subscribe via http://shannonma.wordpress.com/feed/. When you visit sites that have RSS feeds, IE 7.0 and Firefox will enable the RSS icon (in their menu bars) that directs you to the feed. I’ve also added this to the links menu on the right, thanks for the comment!

    shannonma

    July 20, 2008 at 2:45 pm

  8. This looks pretty cool. Are you still planning on a release for next Monday?

    Joe

    Joe Shonk

    July 21, 2008 at 8:52 pm

  9. Quick clarification – when the new server comes up, will it automatically be inserted into existing published applications as a viable server in the workload (same as the one that it was cloned from?)
    You mentioned the server-on-demand possibility which a great – but definitely need the published app piece automated to work for that.

    Thanks – and great job!

    JR

    July 22, 2008 at 2:59 pm

  10. I would think adding published applications for servers-on-demand would be something you would do with Workflow Manager.

    Joe

    Joe Shonk

    July 22, 2008 at 7:15 pm

  11. Thanks for the feedback Joe. I have received some feedback from internal beta testers that I’d like to address before releasing the tool. Some additional time will be needed to take care of this, but you should see it on the web by the end of August.

    shannonma

    July 22, 2008 at 9:13 pm

  12. JR, when the new clone comes online it will be detected by IMA as a new server that joined the farm… as if you just installed XenApp on this machine. You’re right about needing some automation to publish the apps, this is where Workflow Studio would come into play.

    shannonma

    July 22, 2008 at 9:20 pm

  13. A great idea – something I could have done with here in my current role. I’ll be watching this!

    Dan Willis

    July 23, 2008 at 9:16 am

  14. [...] one of my previous posts, I talked about a tool (XenAppPrep) I developed that automatically prepares a XenApp installation [...]

  15. Hi

    Just popping back to see if this great sounding tool had been released, and understand further testing is required? Are you accepting external testing, and if so feel free to contact on my email address.

    Many thanks

    Janson

    Janson Ragon

    July 29, 2008 at 11:30 am

  16. I’m working on addressing the feedback I received from an internal beta test of the tool. Some additional time will be needed to take care of this, but the tool should be available as a download by the end of August. I’ll post a blog here once it goes live, so if you’d like to be notified you can subscribe to the RSS feed.

    shannonma

    July 29, 2008 at 3:14 pm

  17. Thanks for the feedback, look forward to testing out the tool when its available.

    Cheers

    Janson Ragon

    August 5, 2008 at 8:41 am

  18. I’m having an issue with the tool and I would like to understand it. The XenAppPrep service is not starting and the Citrix SMA service as well.

    Cristian Diaz

    August 27, 2008 at 1:16 pm

  19. Shannon,

    When are you releasing the version? I have a customer that is using the beta version I believe. I’m helping them out with “down sessions” issue we are having…

    Cristian Diaz

    August 27, 2008 at 4:28 pm

  20. I’ve been working with the Product Management Team at Citrix to ensure the tool will be supported via our support channels before its released. We’re wrapping up the final bits and pieces of this. The new tentative release date for the tool is 10-Sep-08, the same day XenApp 5.0 will be released for general availability. I’d like to collect some additional info on the problem you’re seeing with the XenAppPrep and SMA services, could you contact me via the Contact page and let me know the details of your environment (e.g. OS, XenApp version, etc.) in addition to the steps you took to run the tool? If you see errors in the Event Log from any Citrix service, please attach them as well. Thanks!

    shannonma

    August 30, 2008 at 1:24 pm

    • This tool is an Citrix admin’s dream. It worked great on redeploying one of our farms.
      I do have a questions about using XenAppPrep and Sysprep for a PS server with remapped drives. Is there a way to use Sysprep in this situation? I have read about using NewSID, but it seems much more complicated. With XenAppPrep and Sysprep I can deploy servers in minutes and I would like to keep it that way. Thanks!

      Mike

      May 1, 2009 at 9:40 pm

      • Thanks for the feedback Mike. XenAppPrep doesn’t address the remapped drives issue. How are you cloning your XenApp servers? I haven’t experienced this issue myself, however it sounds like it may be particular to some drive cloning apps (namely Ghost, Acronis is supposed to work fine). There’s a thread that was posted on the Citrix Forum a while ago that talks about this and lists a workaround (http://forums.citrix.com/message.jspa?messageID=157815). If you’re using Ghost, you should be able to use the workaround and XenAppPrep to do something like this:

        Create your sysprep answer file and within it have a run once action that will rename the HKLM\System\Mounted Devices\DosDevices\C: value to your remapped drive letter. Also, set HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Userinit to begin with your remapped drive letter.
        Run XenAppPrep.
        Go to “HKLM\System\Mounted Devices”. Delete the drive letter entries and thier associated GUIDs for all volumes.
        Go to “HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Userinit”. Change the path to Userinit.exe to begin with C:\ instead of your remapped drive letter.
        Run sysprep and Ghost as you normally do.

        Hope this helps.

        shannonma

        May 2, 2009 at 2:16 pm

    • I am imaging using ShadowProtect from StorageCraft. I attempted to use a RunOnce command in the sysprep.inf file using the following syntax:
      REG DELETE HKLM\SYSTEM\MountedDevices
      REG IMPORT %systemdrive%\Sysprep\MD.reg
      REG ADD HKLM\SYSTEM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v Userinit /t REG_SZ /d M:\WINDOWS\system32\userinit.exe, /f
      It was not successful. After the minisetup I was again presented with message saying that the systems could not find userinit.exe.
      Interestingly I did find a related article that has a good solution to correct the issue.
      http://www.acronis.com/support/kb/articles/778/index.html

      Mike

      May 5, 2009 at 4:52 pm

  21. Hi Shannon,

    Is the tool going to be realeased soon … I am hoping to give it a try on some servers I have here waiting to be setup.

    Thanks,
    Steve

    Steve

    September 11, 2008 at 6:14 pm

  22. Any update on the release of your XenAppPrep tool?

    Carl Webster

    September 13, 2008 at 1:59 pm

  23. Hi Shannon, I’m eagerly awaiting xenappprep. Has it been released?

    Gerald Livingston

    September 15, 2008 at 4:58 am

  24. Dear Shannon,

    where can I find the final version, if the tool has been released? I already used the beta version in a pvs 5 – xa 4.5 environment with fantastic results…

    Alex Goerg

    September 15, 2008 at 7:39 am

  25. Hi Sahnnon, I’m guessing the date slipped a bit since the 10th Sept? Any news on when we might be able to get our hands on the tool!!

    Cheers

    Janson

    Janson Ragon

    September 16, 2008 at 8:31 am

  26. [...] Soon To Be Released I’ve been getting a lot of e-mails about the release of XenAppPrep and have decided to write a blog post to let everyone know what’s going on.  Although I have [...]

  27. [...] XenAppPrep Soon To Be Released Cloning a XenApp Server with XenAppPrep [...]

  28. Looking forward to the release of this. One of our 3rd party partners (will remain nameless) cloned one of our production servers for DR purposes then connected it to the network. Would appear they did nothing to strip out the machine specifics, our edgesight server now reports the data of the production server as the DR server. Think this kind of applicaiton will help greatly simplify and de-risk what is the simplest form of scaling out a XenApp farm.

    Keep up the good blogging, have added a link to your blog from my own blog site

    http://www.virtualpro.co.uk

    C Stewart

    September 28, 2008 at 10:52 am

  29. [...] also proud to announce that we did release XenAppPrep online at http://community.citrix.com/display/xa/XenAppPrep+Tool. If you have any feedback for [...]

  30. Is the xenappprep tool integrate the ctxsma/ctxcpsvc re-creation tool ?

    MaxB

    November 18, 2008 at 4:36 pm

  31. Hi Shannon,
    Does XenAppPrep tool makes adjustments for SSL relay with private certs? or do I have to remove the certs from the master image and install them subsequently on the individual servers in the Farm?

    WayneB

    November 19, 2008 at 7:29 pm

  32. Can I use the XenAppPrep tool for CAE 2.0 ?

    edwinhouben

    March 11, 2009 at 7:16 am

    • XenAppPrep is only supported with XenApp and hasn’t been tested with CAE.

      shannonma

      March 11, 2009 at 11:54 am

  33. DO you run xenappprep 1st then syspre on a xenapp box before cloning it…..if so what are the switches for sysprep on widows 2008 that will be used before cloning

    Thanx

    robin

    May 27, 2009 at 7:14 pm

  34. Hi Shannon,

    Thanks for a great tool. It works a treat!
    I just have a few queries that I’m hoping you can assist with. Firstly we are deploying our XenApp servers with PVS using standard image mode with cache on the client’s HDD.
    We wanted to move the LHC to the client drive (D:) to allow the IMA service to start should the Data Store be unavailable. My question regarding this is does XenAppPrep clear the LHC at boot-up? because if it does there is no benefit in moving the LHC.
    The other query I have is more of a feature request than anything else. When a XenApp server communicates with the license server it creates a license cache file that gives it 30 days grace, however on with PVS in standard mode this license file is lost at reboot, which means that if a XenApp server comes up and the license server is not available users cannot log in. Is it possible to modify XenAppPrep to copy the cache file to a local client drive and copy it back to the boot drive if required?
    Again: thanks for the tool, it is really useful.

    Regards,
    Sean

    Sean

    July 28, 2009 at 10:20 am

    • Hi Sean,

      XenAppPrep clears the LHC when its run from command-line. I no longer work for Citrix, however if you’d like to get these filed as feature requests I’d recommend contacting Citrix support. They can get your request routed to the right team. Sorry I couldn’t be of more help.

      Shannon

      shannonma

      July 29, 2009 at 12:21 am


Leave a Reply