【修改活动目录用户帐号的密码】
由于经常有人问及此方面的问题所以我将整理出来的代码放到这里,大家参考一下:
使用前请添加COM引用:Active DS Type Library
一下代码在VB.NET下编译通过
Function DomainPassWord() As String
Dim info As New ActiveDs.ADSystemInfoClass()
Dim retDomain As String
retDomain = havedomainname(info.DomainDNSName)
Dim OUname As String = "Users "
Call getuser(retDomain, "Administrator ", OUname, " ", " ")
End Function
Private Sub getuser(ByVal strDomain As String, ByVal strUser As String, ByVal organizationname As String, ByVal oldPasswd As String, ByVal newPasswd As String)
Dim user As ActiveDs.IADsUser
Try
user = GetObject( "LDAP://CN= " & strUser & ", " & organizationname & ", " & strDomain)
user.ChangePassword(oldPasswd, newPasswd)
Catch ex As Exception
Response.Write( "
推荐阅读
- Adobe illustrator移动修改锚点的操作流程
- steam修改账户名
- Windows 2000用户管理--活动目录实例
- 王者荣耀活动语音怎么领取
- Microsoft Windows 活动目录远程堆栈溢出缺陷
- windows2000下dns和活动目录关系浅析
- 2 远程安装、无人值守安装和映像安装
- 2 通过.NET Framework访问活动目录
- 配置Win2K的活动目录和解决群集使用的外部存储问题
- 1 通过.NET Framework访问活动目录