Home > PowerShell Scripting, Web Interface > Remove Citrix Web Interface 5.4 IIS recycling via a script.

Remove Citrix Web Interface 5.4 IIS recycling via a script.

Ever notice that the first login to the web interface in the morning takes quite some time? This is because the citrix application pool in IIS is, by default, set to recycle nightly at 02:00. After the recycle the web-interface is rebuilt causing a delay to the first user to attempt to log in.

This delay can result in users logging tickets for a slow login process. For this reason I like to disable this value where I can.

It’s always irked me that with previous versions of IIS, this pool recycling was unavailable for scripting (at least to my meager brain) via wmi, regedit or other method.

During my XenApp 6.0 testing i noted that with IIS 7, there’s now a powershell module you can import to tackle this value.

To remove the default 02:00 recycle from the Citrix 5.4 web interface pool, use the below script:

Please note, this will set your powershell execution policy to unrestricted, this is a side affect of the WebAdministration calling a script. To revert at the end of the script, run the following command after utilizing this script “set-executionpolicy restricted”

if (!(get-module | where {$_.name -eq "webadministration"})){

    if (!(get-module -listavailable | where {$_.name -eq "webadministration"})){
    write-error "WebAdministration snapin not available, failing"

    #this is needed as the module is seen as a script in some cases
    set-executionpolicy unrestricted -force

    #add the module
    write-host "adding IIS Powershell Module"
    import-module webadministration    
}#end if

$CitrixPool = get-childitem "IIS:\AppPools" | where {$_.name -eq "CitrixWebInterface5.4.0AppPool"}

$schedulePath = $CitrixPool.ItemXPath + "/recycling/periodicRestart"

$count = $CitrixPool.recycling.periodicRestart.schedule.Collection.Count

#remove scheduled time(s)
Do {
   Remove-WebconfigurationProperty $schedulePath -Name schedule.collection -AtIndex ($count - 1) -Force

Until ($count -eq "0")
  1. September 19, 2011 at 11:30 am

    What about instead of disabling the recycling – use a script to hit the site after the scheduled recycle?

  2. September 19, 2011 at 11:44 am

    Hi Aaron,

    Thanks for taking the time to drop by and post 🙂 That’s a great idea, I’m thinking powershell + scheduled task.

    I’ll see what i can come up with.

    Thanks again,


  3. September 19, 2011 at 5:58 pm

    Thanks for the article, and the thought of hitting the sit after the recycle. If you come up with a script to do that, please post it!

  4. julien sybille
    February 20, 2012 at 3:50 pm

    in my point of view I prefer applied this CTX for solve this problem http://support.citrix.com/article/CTX117273

    again thanks to .Net 2.0 😦

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

<span>%d</span> bloggers like this: