/// <summary>
        /// Create a new web site on the IIS instance.
        /// </summary>
        /// <param name="serverComment">The server comment.</param>
        /// <param name="rootPath">The path to the root virtual directory of the web site.</param>
        /// <param name="serverBindings">A list of ServerBinding objects to apply to the web site.</param>
        /// <returns></returns>
        public WebSite CreateWebSite(string serverComment, string rootPath, ServerBinding[] serverBindings)
        {
            const string METHOD = "CreateNewSite";

            // create a list of serverbindings...
            List<ManagementObject> bindings = new List<ManagementObject>();
            Array.ForEach(serverBindings, binding => bindings.Add(CreateServerBinding(binding)));

            // create the site..
            ManagementObject w3svc = new ManagementObject(this.Scope, new ManagementPath(@"IISWebService='W3SVC'"), null);
            ManagementBaseObject parameters = w3svc.GetMethodParameters(METHOD);

            parameters["ServerComment"] = serverComment;
            parameters["ServerBindings"] = bindings.ToArray();
            parameters["PathOfRootVirtualDir"] = rootPath;

            ManagementBaseObject result = w3svc.InvokeMethod(METHOD, parameters, null);
            Match m = Regex.Match((string)result.Properties["ReturnValue"].Value, "'(.*?)'");

            return new WebSite(this.Scope, serverComment, m.Groups[1].Value);
        }
        private ManagementObject CreateServerBinding(ServerBinding binding)
        {
            ManagementObject managementObject = CreateManagementObject("ServerBinding");
            managementObject.Properties["Hostname"].Value = binding.HostName;
            managementObject.Properties["IP"].Value = binding.IPAddress;
            managementObject.Properties["Port"].Value = binding.Port;

            return managementObject;
        }