Modify Web Interface En-Masse

I’ve got a ton of Web Interface servers.  There’s a lot of reasons why, but at the end of the day modifying Web Interface site by site is a serious pain.  And when you have multiple sites per Web Interface then you could easily find yourself needing to modify 40-50 sites to make a simple change.  Or have a WI server with multiple sites that you need to clone.  Before we start there are a couple of things you need to be aware of:

1) Web Interface is primarily driven by modifications to the WebInterface.conf file.  You can find this file in the inetpub\wwwroot\Citrix\yoursite\conf folder.  Anything you do in the GUI you will find in this file.

2) You can copy site files between servers, but you have to create the site first in Web Interface.  So say you have a new server with IIS and all set up.  Run through the WI wizard to create the site you want with the same name as the one you are going to copy.  Just take all the defaults regardless of what you want the final config to be.  Once the wizard if done uncheck “Configure this site now” and exit the wizard.  Go to your original server and copy the entire folder containing the same site over to the new server, making sure to overwrite.  Poof, you’ve cloned it.

That said a lot of times you will want or need to make changes to your site files.  We put the server name in the Footer test for instance so that if users have an issue it is captured in the screenshot.  Copying files between servers can make that a challenge, and having to click through all the screens of the GUI to edit each one is a pain.  You could directly edit the webinterface.conf but you would need to do that for every site.  I was poking around for a better way to do this and finally found one thanks to a coworker.  The answer is Windows Grep.

Windows Grep is a donation-ware tool that allows you to do recursive searches of any file it can read for specific lines of text and then it has a feature to do a mass replacement.  Huzzah!  I will walk though a quick modification to demonstrate what you can do with it is in order.  Let’s start with a view of the Web Interface dashboard:



I blacked out my site names for legal reasons but you get the picture.  This server has 11 sites on it.  You can see them all listed in Explorer here:



And within each of these sites you have a WebInterface.conf file.  When you crack one open this is what you see:



All those lovely text lines to edit!  And with our new tool Windows Grep we can go to town on it.  In this example I am going to modify a site to change the XML brokers for a farm.  I want to reverse the XML order for a single farm across every site on the server.  Here are the original farm settings:



So after you install Windows Grep on your Web Interface server open it up.  Make sure to do it as Administrator because depending on your lockdowns editing directly in the IIS folders requires Admin.  When you open it you are presented with this:



The first this I put in is the existing XML brokers.  When you look at the WebInterface.conf file above you can see where I got the line to search for under Farm1.  I want to swap those two!  So I put that in as the text to find.


Next I drill into the top level Citrix folder.  All my sites are underneath it.  Make sure “Search in Subfolders” is checked!  Click Next.  Then you will have to manually put in Webinterface.conf as the file to search and click Finish.  This is the result:



So you can see that it found 1 instance of that text string in every one of the conf files.  Now we want to replace that with our new string.  So we click the little flashlight button with the A+B under it.  You get this:



So we enter the text string that we want to replace the original search with.  I am reversing the XML order.  Click Next.




On this screen you need to make sure to select “Make changes to original file(s)” so that it replaces your current WebInterface.conf file.  Click Finish!



As you can see, it went through each file and made the change.  It creates a backup of the original as well!  And that’s it… the whole thing is changed on every site.  And here’s how it looks all finished.



So there you go!  A massive time saver especially with more complicated changes.  Could you do this through the GUI?  Sure!  But where’s the fun in that 🙂  If you use WinGrep and like it I do suggest donating.


, ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">