title: How to Stop IIS Website on muliple Servers using checkedlistbox
body: <p>I have a winform that can stop and start IIS website remotely however I'm looking for a way to stop/start website on muliple servers by using checkedlistbox. Here's my Stop IIS website code</p>
  
  <pre><code>   private void buttonStop_Click(object sender, EventArgs e)
      {
          string serverName = textServer.Text;
          string siteName = cmbWebsite.SelectedItem.ToString();
  
  
          using (Microsoft.Web.Administration.ServerManager sm = Microsoft.Web.Administration.ServerManager.OpenRemote(serverName))
          {
  
              Microsoft.Web.Administration.Site site = sm.Sites.Where(q =&gt; q.Name.Equals(siteName)).FirstOrDefault();
              // If the site does not exist, throw an exception       
              if (site == null)
              {
                  throw new Exception("The specified site was not found!");
              }
              // Stop the site        
              site.Stop();
              showStatus(siteName);
  
          }
      }
  </code></pre>
  
  <p>I wanted to be able to run this on multiple servers so instead of putting the server (textServer) on the text box. User can just check on which server/server they wanted to stop. </p>
  
  <p>Any assistance is greatly apprecieated. </p>
  
  <p>Thanks!</p>