Imagine I have domain 'myDomain', domain user 'myDomain\domainUser', my computer is 'myComputer', local group is 'Guests'.
I used many approaches but neither worked. The latest code I have used is following:
Expand|Select|Wrap|Line Numbers
- DirectoryEntry domainUser = new DirectoryEntry("LDAP://myDomain/CN=domainUser,CN=Users,DC=myDomain,DC=local");
- DirectoryEntry computer = new DirectoryEntry("WinNT://myComputer,computer");
- DirectoryEntry guests = computer.Children.Find("Guests", "group");
-
if (guests != null)
guests.Invoke("Add",new object[] { domainUser.Path.ToString() });
Any ideas how to do it ?