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:

Post a Comment

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.