I have this simple code:
String containerPath = String.Format("WinNT://{0}/{1},group", Environment.MachineName, localGroupName);
using (System.DirectoryServices.DirectoryEntry theContainerGroup= new System.DirectoryServices.DirectoryEntry(containerPath ))
{
String path = String.Format("WinNT://{0}/{1},group", theGroupToAdd_Domain, theGroupToAdd_Name);
theContainerGroup.Invoke("Add", new object[] { path});
theContainerGroup.CommitChanges();
}
and it seems to work okay for Global and Universal groups. However when I try to add a group that has type DomainLocal|Builtin, it gives me a "cannot find object" exception.
Is that not a supported scenario? Or do I need to alter my path for that type of group?