I want to recycle my application pool using one-liner command which I can put in my PowerShell script. I added the following code in my PowerShell script:
Import-Module WebAdministration
$site = "Default Web Site"
$pool = (Get-Item "IIS:\Sites\$site"| Select-Object applicationPool).applicationPool
Restart-WebAppPool $pool
But I am getting an error that name IIS doesn't exist. How can I fix it?
I like when answers are short and simple, like this...
Restart-WebAppPool (Get-Website -Name <YourSiteName>).applicationPool
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With