Saturday, July 22, 2017

Not all settings from Get-IISAppPool can be committed

IIS app pools (along with other IIS configuration) can be managed with PowerShell. One user wanted to change the logging options of an app pool (probably acquired from Get-IISAppPool), but couldn't figure out how. The LogEventOnRecycle property of the Recycling member on the app pool object seems to be the relevant part, but changes don't stick.

Fortunately, there's an alternate way of working with IIS from PowerShell. If the WebAdministration module is imported, the IIS:\ drive contains IIS objects that can be read and changed with Get-ItemProperty and Set-ItemProperty. To change logging settings, get the recycling property on the app pool, revise the logEventOnRecycle member of that object, then set the recycling property with the altered configuration section.

No comments:

Post a Comment