3

Need to create a PowerShell script to recycle the Application Pool of my WFE - Dev,Staging & Production servers of my SP 2013 Farm.

I tried code mentioned here

But somehow as mentioned in the blog, it seems, its applicable to Win Server 2008 only.
Also I tried this too:

  # Load IIS module:
 Import-Module WebAdministration
 # Set a name of the site we want to recycle the pool for:
 $site = "Default Web Site"
 # Get pool name by the site name:
 $pool = (Get-Item "IIS:\Sites\$site"| Select-Object     
 applicationPool).applicationPool
 # Recycle the application pool:
 Restart-WebAppPool $pool 

Don't know what I am missing here

5
# Load IIS module:
Import-Module WebAdministration
# Adds registered Microsoft SharePoint PowerShell snap-ins
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
# Get SharePoint Web Application
$app = Get-SPWebApplication http://site/
# Get pool name from web application:
$poolName = $app.ApplicationPool.Name
# Recycle the application pool:
Restart-WebAppPool $poolName
-1

Use the following PowerShell code:

test is the name of the Application Pool

import-module webadministration
$a =  get-item IIS:\AppPools\test 
$a.recycle()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.