Usually it is possible to change it´s own password in Windows, without having admin-rights.
I'm writing a tool to manage users and Groups on several servers/clients. I also want to give a client the right to edit his own password. The clients don't have admin-rights of course. To change a users password having admin rights I used DirectoryEntry like this:
try
{
DirectoryEntry localDirectory =
new DirectoryEntry("WinNT://" + Environment.MachineName.ToString());
DirectoryEntries users = localDirectory.Children;
DirectoryEntry user = users.Find(username);
user.Invoke("SetPassword", newPassword);
Console.WriteLine("Success!");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
The problem here is, that the DirectoryServices are not available without having admin-rights. Therefore I wish to have a work-around that works without admin rights(only necessary for changing your own password).
DirectoryEntry
to be instantiated with domain admin credentials? – Soothe