![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Vista Home | change password as per users' requests Hi Friends, I m new to progrmamming field and have created a userform that allows the user to enter and work according to his needs however as per one of my user's request , he asked me if I could give them an option to change password . Hence I requets to all genius programers to help me write this in VB Script( I am using Excel as the platform ) |
My System Specs![]() |
| | #2 (permalink) |
| | Re: change password as per users' requests "nerd" <guest@xxxxxx-email.com> wrote in message news:b4ce69e7b6755dd7e7b97d8188545c6d@xxxxxx-gateway.com... Quote: > > Hi Friends, > I m new to progrmamming field and have created a userform that allows > the user to enter and work according to his needs however as per one of > my user's request , he asked me if I could give them an option to change > password . Hence I requets to all genius programers to help me write > this in VB Script( I am using Excel as the platform ) > you bind to the user object, then use the ChangePassword method of the object. You pass the old and new passwords to the method. You need the full Distinguished Name of the current user to bind to the object, but that can be retrieved from the ADSystemInfo object. For example, a script that prompts for required values could be: ========== Option Explicit Dim objSysInfo, strUserDN, objUser, strOldPassword, strNewPassword ' Retrieve DN of current user. Set objSysInfo = CreateObject("ADSystemInfo") strUserDN = objSysInfo.UserName ' Bind to user object with Distinguished Name. Set objUser = GetObject("LDAP://" & strUserDN) ' Prompt for old password. strOldPassword = InputBox("Enter old password") ' Prompt for new password. strNewPassword = InputBox("Enter new password") Call objUser.ChangePassword(strOldPassword, strNewPassword) ======== If the user is a local user you must use the WinNT provider (instead of the LDAP provider). You must bind with the NetBIOS name of the user, but you can retrieve that from the wshNetwork object. Then the code could be: ========= Option Explicit Dim objNetwork, strUser, strComputer, objUser, strOldPassword, strNewPassword ' Retrieve local user and computer. Set objNetwork = CreateObject("Wscript.Network") strUser = objNetwork.UserName strComputer = objNetwork.ComputerName ' Bind to user object in local SAM account database. Set objUser = GetObject("WinNT://" & strComputer & "/" & strUser & ",user") ' Prompt for old password. strOldPassword = InputBox("Enter old password") ' Prompt for new password. strNewPassword = InputBox("Enter new password") Call objUser.ChangePassword(strOldPassword, strNewPassword) -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| New user - repeated password requests in WM | Vista mail | |||
| Users are unable to change domain password | Vista security | |||
| Privision User must change password at next logon, if passwordchanged, set password never expire | VB Script | |||
| Password protect users | Vista networking & sharing | |||
| Windows e-mail and password requests | Vista account administration | |||