xWebAppPool resource takes 40 minutes to find one apppool

Hi All,

I am using xWebAdministration in a node server with WMF 5.0 installed in it. My script contains a loop to find the status of all the apppools in the application server. Each time the xWebApppool resource runs, it takes almost 40 minutes to give the output.

I have almost 60 apppools in the application server which takes more than a day to execute the script. Does this searching takes that much of time or I am missing something. Any help would be much appreciated. Here is the resource module.

   xWebAppPool $appPoolName
            Name = $appPool
            Ensure = $site.Ensure
            State = $site.State
            restartSchedule = $site.IISSettings.RecycleSchedule
            LogEventOnRecycle = $site.IISSettings.LogEventOnRecycle
            CPULimit = $site.IISSettings.CPULimit
            CPUAction = $site.IISSettings.CPULimitAction
            restartPrivateMemoryLimit = $site.IISSettings.PrivateMemoryLimit
            idleTimeoutAction = $site.IISSettings.IdleTimeoutAction
            StartMode = $site.IISSettings.StartMode


Something I’m probably missing here but why are you using DSC to “find the status of all the apppools in the application server” ?

The role of the LCM is to check if there have been changes to the configuration based on a “cached” mof file and based on that
to monitor / apply the correct the configuration.

perhaps a full script might help understand or pinpoint the issue but overall, there are known issues, not only with XWebAdministration but with other dsc resources (like xRegistry for examples), when the DSC configuration has many settings. The behavior would be normal after a restart and gradually get worse along the day. Theres work at the moment, done by the PSTeam to make some of the DSC resources into High-Quality resources that would probably fix these kind of issues.

Not saying yours is caused by what I mentioned above but it sounds similar.

Again, some more info on your script might help.

Try using Measure commands of powershell in your script to see if there are noticeable execution times outside of the DSC part.

As you can see my code, we set the apppool parameters through DSC. So when the xWebapppool resource invokes the xWebAdministraton module, MSFT_xWebAppPool.psm1 runs the following command to get the appPool.

$appPool = Get-WebConfiguration -Filter ‘/system.applicationHost/applicationPools/add’ |
Where-Object -FilterScript {$_.name -eq $Name}

Till now I am not sure which part of the module takes a lot of time to execute the resource, but I think we need some solution to this issue to run the script in a shared environment properly.

As per xWebAdministration Module , to fetch the $appPool the module used

$AppPool = Get-Item -Path IIS:\AppPools* | ? {$_.name -eq $Name}

I tried running all these manually in powershell prompt in a server containing Powershell 4.0 , but it took a lot of time.When I installed Powershell 5.0, the Get-WebConfiguration command took less time.

The whole setup takes lot of time when the number of appPool increases.