iis 7 - How can I set an app pool restart schedule in IIS7 via WMI / Powershell? -
iis 7 - How can I set an app pool restart schedule in IIS7 via WMI / Powershell? -
i creating function manage app pools in iis7 our desired specifications, , having problem converting 1 line our equivalent iis6 script; set restart schedule.
in iis6 line was:
$newpool.periodicrestartschedule = @( '6:15' );
the naive translation iis7 is:
$newpool.recycling.periodicrestart.schedule = @('00000000061500.000000:000')
however doesn't work because throws exception:
exception setting "schedule": "unable cast object of type 'system.string' type 'system.management.managementbaseobject'.
how create scheduleelement[]
array assign value?
$time = ([wmiclass]'root\webadministration:scheduleelement').createinstance() $time.value = '00000000061500.000000:000' $newpool.recycling.periodicrestart.schedule = $time;
problem 2: value doesn't seem save when phone call $newpool.put()
. what's next?
i've given , decided utilize appcmd:
function createapppool( [parameter(valuefrompipelinebypropertyname=$true)][string]$apppoolname ) { process { $appcmd = 'c:\windows\syswow64\inetsrv\appcmd.exe' &$appcmd add together apppool "/name:$apppoolname" "/+recycling.periodicrestart.schedule.[value='06:15:00']" } }
i still interested in seeing how can done without appcmd.
iis-7 wmi
Comments
Post a Comment