修改AD密码的方法

在win2003中已经具备这个功能,为何不用
1、将C:\WINDOWS\system32\inetsrv下面的整个iisadmpwd目录复制到C:\Inetpub\wwwroot下(仅为了不破坏原始文件)
2、WEB共享iisadmpwd目录到80网站上,默认读取和脚本权限即可
3、检查IIS服务的ASP支持是否安装
4、将aexp2.asp更名为default.asp,并根据自己需要修改这个文件,例如没启用证书则将https改为http
5、访问http://moss/iisadmpwd即可修改密码了

这个方法修改密码比写个webpart更安全更标准(因为这个是官方解决方案,哈哈)。

try
{
DirectoryEntry entry1 = new DirectoryEntry("LDAP://" + domain, this._username, this._oldPassword);
DirectorySearcher searcher1 = new DirectorySearcher(entry1);
searcher1.Filter = "(samAccountName=" + this._username + ")";
result1 = searcher1.FindOne();
DirectoryEntry entry2 = result1.GetDirectoryEntry();
entry2.Invoke("ChangePassword", new object[] { this.tbOldPassword.Text, this.tbNewPassword.Text });
entry2.CommitChanges();
entry2.Close();
entry1.Close();

}
catch
{

}

原文地址:https://www.cnblogs.com/chenfulai/p/1407870.html