tags:

views:

880

answers:

3

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?

A: 

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.

sebastian
The users will not be in an ActiveDirectory
A: 

You should be able to do this via DirectoryEntry.

Robert Rouse
+4  A: 

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

Matt Hanson
Very straightforward. It workedThank you