title: How to determine if a website is installed in IIS7 with Powershell?
body: <p>I'm pretty new to powershell, and I'm trying to automate the removal of a prior version of a website and addition of the newer version as a part of a TFS 2010 Build Template (Windows Workflow 4.0). Is it possible to see if a website or web app pool exists in IIS7 with powershell? I've tried running the following command:</p>
  
  <pre><code>import-module WebAdministration
  Get-Website -Name "Default Web Site"
  </code></pre>
  
  <p>The output lists all of the websites installed on the box, not just the default web site.</p>
  
  <pre><code>Name             ID   State      Physical Path                  Bindings
  -------------------------------------------------------------------------
  Default Web Site 1    Started    %SystemDrive%\inetpub\wwwroot  http *:80:
                                                                  net.tcp 808:*
                                                                  net.pipe *
                                                                  net.msmq localhost
                                                                  msmq.formatname localhost 
  MyWebsite1       2    Started    C:\inetpub\MyWebsite1          http *:80:mywebsite1.com
  MyWebsite2       3    Started    C:\inetpub\MyWebsite2          http *:80:mywebsite2.com
  </code></pre>
  
  <p>If I try to run the command without the "-Name" parameter, the result is exactly the same. </p>