public static bool iis7_site_exists(string siteName)
        {
            if(string.IsNullOrEmpty(siteName))
                throw  new NullReferenceException("siteName");

            using (var iisManager = new ServerManager())
            {
                var site = iisManager.GetSiteByNameSupressErrors(siteName);
                return site != null;
            }
        }
        public static void iis7_remove_site(string siteName, bool removeApplicationPool)
        {
            using (var iisManager = new ServerManager())
            {
                var site = iisManager.GetSiteByNameSupressErrors(siteName);

                if (site == null)
                    return;

                if (removeApplicationPool && site.Applications[0] != null)
                {
                    string applicationPoolName = site.Applications[0].ApplicationPoolName;

                    if (applicationPoolName != "Classic .NET AppPool" && applicationPoolName != "DefaultAppPool" && iisManager.ApplicationPools[applicationPoolName] != null)
                        iisManager.ApplicationPools.Remove(iisManager.ApplicationPools[applicationPoolName]);
                }

                iisManager.Sites.Remove(site);
                iisManager.CommitChanges();
            }
        }