Tuesday, September 18, 2012

PowerShell: Recycle an AppPool using AppCmd

Script:

cls
$path = "$env:windir\system32\inetsrv\appcmd"
$return = ."$path" list APPPOOL /apppool.name:AppPoolName
if ($return.Contains("state:Started"))
{
    ."$path" Stop APPPOOL /apppool.name:AppPoolName
}
."$path" Start APPPOOL /apppool.name:AppPoolName

No comments: