C# 密码过期时如何在active directory中更改密码
在Microsoft Active Directory(AD)中,如果某人的密码过期,如何使用其旧密码更改密码 我知道C# 密码过期时如何在active directory中更改密码,c#,.net,active-directory,ldap,C#,.net,Active Directory,Ldap,在Microsoft Active Directory(AD)中,如果某人的密码过期,如何使用其旧密码更改密码 我知道系统。DirectoryService有一个ChangePassword方法,但是当密码过期时它就不工作了 我比你更需要帮助 顺便说一句,不能使用SetPassword方法,因为它必须具有特权。您可以使用netapi32.dll中的函数 [DllImport("netapi32.dll", CharSet=CharSet.Unicode, CallingConventio
系统。DirectoryService
有一个ChangePassword
方法,但是当密码过期时它就不工作了
我比你更需要帮助
顺便说一句,不能使用SetPassword
方法,因为它必须具有特权。您可以使用netapi32.dll中的函数
[DllImport("netapi32.dll", CharSet=CharSet.Unicode,
CallingConvention=CallingConvention.StdCall,
SetLastError=true )]
static extern uint NetUserChangePassword (
[MarshalAs(UnmanagedType.LPWStr)] string domainname,
[MarshalAs(UnmanagedType.LPWStr)] string username,
[MarshalAs(UnmanagedType.LPWStr)] string oldpassword,
[MarshalAs(UnmanagedType.LPWStr)] string newpassword
);