.NET Framework Bookmark and Share   
 index > .NET Base Class Library > Using DirectoryEntry to manipulate local users
 

Using DirectoryEntry to manipulate local users

This link shows how to add users to a group using DirectoryEntry

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/adding_users_to_a_group.asp

Is it possible to add machine local users to a local group?

If yes, what distinguished name would I use?
e.g. if I wanted to add the user foo to the local group bar on the computer qux?

Thanks,
Klas

Klas Mellbourn

Hi Klas,

As the DirectoryEntry class is basically a wrapper over the top of ADSI you should be able to use the ADSI WinNT provider to bind to the local machine and add the user to the groups, rather than the LDAP provider.

This page shows you how to do it using ADSI, it shouldn't be too hard to translate this to DirectoryEntry usage.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsgroup_add.asp

Cheers

Dave

Dave Wright

Hi Klas,

As the DirectoryEntry class is basically a wrapper over the top of ADSI you should be able to use the ADSI WinNT provider to bind to the local machine and add the user to the groups, rather than the LDAP provider.

This page shows you how to do it using ADSI, it shouldn't be too hard to translate this to DirectoryEntry usage.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsgroup_add.asp

Cheers

Dave

Dave Wright

You can use google to search for other answers

Custom Search

More Threads

• Iformatprovider
• pass values between web pages
• side-by-side versioning of assemblies
• how can i utilize unmanaged delphi7 Dll in C# dot net
• Possible to interrupt a synchronous RPC call from client?
• SerialPort parity error
• Custom Event or Event with filter criteria ????
• Checking attributes in custom class LIST using contains -- issues.
• Performance issue in VB.Net 2008 application using more than one SerialPort object
• Bypass .NET Code Access Security checking