Creating local users on a remote Windows server using C #

If I have administrator access, I need a way to manage (create, modify, and delete) local accounts on the remote computer from the ASP.NET client.

I do not know how to approach this. Is WMI (System.Management namespace) possible? Any pointers?

+5
source share
3 answers

Try:

DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://ComputerName" & ",computer", "AdminUN", "AdminPW");
DirectoryEntry user = directoryEntry.Children.Add("username", "user");
user.Invoke("SetPassword", new object[] { "password"});
ser.CommitChanges();

If you need to go through the Active Directory route, you can change the directoryEntry path to something like this: LDAP: // CN = computer_name, DC = MySample, DC = com

+4
source

System.DirectoryServices n ActiveDirectory (LDAP). , , .
, .

0

You should be able to do this through DirectoryEntry.

0
source

All Articles