From microsoft doc. [
[To see links please register here]
][1]
Restart-WebAppPool recycles an application pool.
Then you don't have to think of a stop, wait, and start.
Import-Module WebAdministration
For a specific running AppPool
$applicationPoolName = 'DefaultAppPool'
Get-ChildItem IIS:\AppPools | Where {$_.State -ne "Stopped" -and $_.name -eq $applicationPoolName} | Restart-WebAppPool
For all running AppPools
Get-ChildItem IIS:\AppPools | Where {$_.State -ne "Stopped"} | Restart-WebAppPool
[1]:
[To see links please register here]