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?