Citrix XenApp - Unpublish Applications Script
Ever had to take a Citrix server out of the farm? Sure you have, everyone has at some point or another.
This can be achieved in a number of ways. You could stop the server accepting connections but if your server is in a remote datacentre and you don’t have ILO (HP), DRAC (DELL) or RSA (IBM) then you can’t remote desktop on to it to do the maintenance.
You could block ICA Connections in Terminal Services Manager but then what happens to users who are on the server already? Well they’re going to have issues connecting to existing sessions.
My preferred option is to unpublish all the applications from the server the day before the maintenance. This means that the users can still access the applications they’re already connected to and that over time the server will clear down as users log off.
During a recent XenApp deployment project myself and a olleague came up with a script to unpublish all applications on a named server. The Script writes out a note of the unpublished applications to a text file in the same folder as the scripts so that you can run another script to reverse the process after maintenance is complete. This proved invaluable during the project and has been used quite a lot since the farm went into production.
svroffline - Script to unpublish all applications
svronline - Script to republish all applications
You can run this from a XenApp server without issue but if you want to run it from your machine you will need the Citrix SDK installed so that your client PC has the MFCOM objects required locally by the script.
Let me know how you get on with this or if you have any questions.




