title: Recycle an application pool using a PowerShell script
body: <p>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:</p>
  <pre class="lang-none prettyprint-override"><code>Import-Module WebAdministration
  
  $site = &quot;Default Web Site&quot;
  
  $pool = (Get-Item &quot;IIS:\Sites\$site&quot;| Select-Object applicationPool).applicationPool
  
  Restart-WebAppPool $pool
  </code></pre>
  <p>But I am getting an error that name <a href="https://en.wikipedia.org/wiki/Internet_Information_Services" rel="nofollow noreferrer">IIS</a> doesn't exist. How can I fix it?</p>