Powershell App Pool set periodicRestart syntax Powershell App Pool set periodicRestart syntax powershell powershell

Powershell App Pool set periodicRestart syntax


It's interesting that you're seeing it as a [Hashtable]. I see it as a [Microsoft.Iis.Powershell.Framework.ConfigurationElement].

It has a method called .UpdateCollection() which expects a [PSObject[]], so it's looking for an array of objects.

The thing is, calling that method, whether on a pool object returned from New-WebAppPool or from Get-Item IIS:\AppPools\ExistingPool, results in an error stating that it's read only.

I tried replacing the entire .Collection with a new arraylist with timespan objects added to it, and I got no errors, but it didn't set the values.

I also tried creating a ConfigurationElement object, but it seems to have no constructor, so it's probably a private class somewhere in the code.

I'm not saying there's definitely no way to do it like you want, but it seems like you'll be best off just using Set-ItemProperty as it seems that some of these attributes were designed to be updated only through the PS Provider.