Setting recycle properties on IIS7 App Pools using powershell 2.0

0

I am trying to set the current properties using powershell

  1. disallowRotationOnConfigChange
  2. disallowOverlappingRotation

I do this with the following code

$appPools = Get-childItem IIS:\AppPools
foreach ($appPool in $appPools)
{
    $appPool.name
    Set-ItemProperty $path -Name recycling.disallowRotationOnConfigChange -value True
    Set-ItemProperty $path -Name recycling.disallowOverlappingRotation -value True
}

after this executes I go check in inetmgr and the properties have not budged from False... what am I doing wrong here ?

krystan honour

Posted 2013-02-01T11:26:14.467

Reputation: 119

Answers

1

Stupid me this script misses an entire line :)

for those who haven't spotted it the script should read

$appPools = Get-childItem IIS:\AppPools
foreach ($appPool in $appPools)
{
    $path = "IIS:\AppPools\$($appPool.Name)"
    $appPool.name
    Set-ItemProperty $path -Name recycling.disallowRotationOnConfigChange -value True
    Set-ItemProperty $path -Name recycling.disallowOverlappingRotation -value True
}

no good not defining $path :)

This fixes the above script

krystan honour

Posted 2013-02-01T11:26:14.467

Reputation: 119

1@krystanhonour you can accept it now :) – Tom Robinson – 2015-01-26T12:07:12.103

Did this fix it? – BenjiWiebe – 2013-02-01T13:38:02.677