How to set password for users in Active Directory through vbscript



Below is the sample vbscript to set password for Users in Active Directory

'First connect to container (OU) under which we will create user
TempUserName="TempUser"
Set objUser = GetObject("LDAP://cn=TempUserName,OU=TestOU,DC=TEST,DC=COM")

objUser.SetPassword "Testme123"
'Also set password never expires
objUser.Put "PasswordExpired", CLng(1)
objUser.SetInfo

Wscript.echo "Sucessfully Set password for user TempUser"


Code above connects to the active directory object with CN=TempUser, ( connects to user TempUser) under TestOU, domain Test.com. The SetPassword will set the provided password for user and additionally we can set Password Never expires flag for that user.  

Comments

Popular posts from this blog

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

Exception handling with RestTemplate