title: How to check whether an application pool exists or not in IIS using powershell and web administration module?
body: <p>I am using powershell to automate configuring websites in my IIS. I have the following code that creates a web application pool for me</p>
  
  <pre><code>#Creating a new Application Pool
  New-WebAppPool "NewAppPool"
  </code></pre>
  
  <p>But before creating the pool, <strong>I want to check whether pool exists or not.How do I go about doing this?</strong></p>
  
  <p><strong>Please note : There is no IIS Drive on my system.</strong> And hence commands which have IIS mentioned in the path like the following <strong>fail</strong> :</p>
  
  <pre><code>$IISPath = "IIS:\AppPools"
  cd $IISPath
  if (Test-Path ".\NewAppPool") { Write-Host "NewAppPool exists." }
  </code></pre>