Win32 API ChangePassword
[DllImport("Netapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern int NetUserChangePassword(
string domainname,
string username,
string oldpassword,
string newpassword
);
public static bool ChangePassword(string username, string domain, string oldpassword, string newpassword) {
int result = NetUserChangePassword(
domain,
username,
oldpassword,
newpassword
);
if (result != 0)
//throw new Win32Exception();
return false;
return true;
}
正面猛男