Reset of app pool in IIS using powershell
I needed to reset IIS using PowerShell script
Lets define our script first as it it easy to update or automate
$site = "CpoDesign HomeSite"
No the script should be pretty agnostic and we are able to transfer it anywhere.
To use the IIS module we need to import it.
Lets use the powershell querying to retrieve app pool property from object associated with our site using
$pool = (Get-Item "IIS:\Sites\$site"| Select-Object applicationPool).applicationPool
Now the final command
Note: If you might experience issues it might be due to access rights, so make sure that the script is tested under right credentials
For your convenience here is full script below or link here
# Set a name of sie we want to recycle the app pool for: $site = "CpoDesign HomeSite" # Import the IIS module: Import-Module WebAdministration # Find the item from IIS and from selected objects select the app pool property $pool = (Get-Item "IIS:\Sites\$site"| Select-Object applicationPool).applicationPool # Restart the application pool Restart-WebAppPool $pool