user25885
user25885

Reputation: 53

Creating local users on remote windows server using c#

Provided I have admin access, I need a way to manage (Create, modify, remove) local accounts in a remote machine from an ASP.NET client.

I'm clueless in how to approach this. Is WMI a possibility (System.Management namespace)? Any pointers?

Upvotes: 5

Views: 3236

Answers (3)

Matt Hanson
Matt Hanson

Reputation: 3504

Give this a 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 do need to go the Active Directory route, you can change the directoryEntry path string to something like this: LDAP://CN=ComputerName,DC=MySample,DC=com

Upvotes: 4

Robert Rouse
Robert Rouse

Reputation: 4851

You should be able to do this via DirectoryEntry.

Upvotes: 0

sebagomez
sebagomez

Reputation: 9609

I used System.DirectoryServices to get data from users in a n ActiveDirectory (LDAP). I don't know if that's the kind of thing you're looking for.
Hope it helps.

Upvotes: 0

Related Questions