Iis – Remove Specific Recycling Time For IIS With PowerShell

iispowershellremove

We need to keep an IIS application pool alive as long as possible for long processing. The app pool in our std config has a 03:00AM restart in the array. I need to remove this. I can do it manually via the UI but it needs to be scripted.

I can see the the element with this code:

$pool = "IIS:\AppPools\my_app_pool"
Get-ItemProperty -Path $pool -Name recycling.periodicRestart.schedule.collection

That returns:

value          : 03:00:00
Attributes     : {value}
ChildElements  : {}
ElementTagName : add
Methods        : 
Schema         : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema

I can set the element (if I wanted to change it) with:

Set-ItemProperty -Path $pool -Name recycling.periodicRestart.schedule.collection -Value @{value = '06:00:00'}

But I want to delete it completely so there are no elements in the array.

I've tried:

$ArrList = @()

Set-ItemProperty -Path $pool -Name recycling.periodicRestart.schedule.collection -Value $ArrList

and variations of it, and NULL, but not able to kill the array or make it empty.

I am out of ideas for the moment. Any help appreciated.

Thanks.

Best Answer

This did it

remove-ItemProperty $pool -Name recycling.periodicrestart.schedule.collection