Question : How do I delete a group from active directory?
What I have tried:
1. PrinipalContext
I am trying to delete an active directory group. I have this right now:
using (var ctx = new PrincipalContext(ContextType.Domain, myDomain, ldapUser, ldapPassword))
{
var group1 = new GroupPrincipal(ctx, groupName);
group1.Delete();
}
But I get an error: "Unpersisted Principal objects can not be deleted."
That lead me here, but I don't know what the invoke
magic is all about and it scares me a little bit.
2. DirectoryEntry
http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C#33
But I just kept getting "The server is not operational"
errors.
I just need to delete the AD group, is it even possible?