본문 바로가기

IT Professional/Windows Management Technology

Ad Password 변경 Script

<%@ Language=VBScript%>
<%=Request.ServerVariables("AUTH_USER")%>
<td></td>

<html>
<head></head>
<body>
<form name='form1' method='post'>
<input type='text' name='oldpasswd' /><br/>
<input type='text' name='passwd' />
<input type='submit' name='submit' value='submit' />
</form>
</body>
<%

Sub ChangePassword(sOldpassword, sNewPassword)
   Set objSysInfo = CreateObject("ADSystemInfo")
'
'   Response.Write(objSysInfo.UserName)
'   Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
'   objUser.Password = sNewPassword
'   objUser.SetInfo
'   Set objUser = Nothing
'   Set objSysInfo = Nothing

Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
objUser.ChangePassword sOldpassword , sNewPassword

End Sub

Dim NewPassword, OldPassword
OldPassword= Request("oldpasswd")
NewPassword = Request("passwd")
if NewPassword <> "" Then
    Response.Write(NewPassword)
    call ChangePassword(OldPassword, NewPassword)   
    Response.Redirect("check.htm")
end if

%>
</html>