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 {$ -eq "webadministration"})){

    if (!(get-module -listavailable | where {$ -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 {$ -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")

Related Posts

New Module: Creating an RDP file password with Pow... Here's something that is surprisingly tricky to automate in this day and age. Creating a password and storing it in an RDP file. I'm not here to debat...
Dealing with multi numbered versions in powershell... So here's a quick little blog about something i discovered in powershell while googling today. Lots of vendors like to use version numbers includin...
Accurately checking the Citrix PVS “cache in... Citrix Provisioning services "Cache in RAM, overflow to disk", even with it's challenges is something I've always felt was a great idea, hell, I fores...

4 Comments About “Remove Citrix Web Interface 5.4 IIS recycling via a script.

Leave a Reply