public void CreateWindowsGroup(String groupName, String groupDesc, int groupCtl) { String ladpRootPath = "LDAP://192.168.213.168/CN=Users,DC=pk1,DC=cctv,DC=com"; DirectoryEntry ladpRoot = new DirectoryEntry(ladpRootPath); ladpRoot.Username = "XXXXX"; ladpRoot.Password = "XXXXX"; DirectoryEntry group = ladpRoot.Children.Add("CN=" + groupName, "group"); group.Properties["sAMAccountName"].Value = groupName; group.Properties["description"].Value = groupDesc; group.Properties["groupType"].Value = groupCtl; group.CommitChanges(); group.Close(); }