IPAM will assist
you in managing IP addresses.
To let you into a secret, this utilities is fun to use, even if you
don't have a pressing need to calculate your IP address space.
Get a free evaluation copy of
Orion IPAM
Is your server running slowly? Check with SolarWinds ipMonitor
Get a free evaluation copy of ipMonitor
Contents of Guy's Scripting Ezine 11 - Passwords
This week's theme is changing passwords. I will show you how to set the password on a new account or change an existing account password. When you copy and paste the script
below, remember to substitute your domain for: cp.com and also
your organizational unit for ou=Worcester.
This is an extra preliminary script to create a user so tht we can change their password. Copy and paste the examples below into notepad.exe IMPORTANT: Change the 'ou=Worcester' to an OU in your Active Directory.
N.B. Change 'cn=Guido' to the name of a user you wish to create. Save the script with a .vbs extension, and double click the file to test it.
'
' VBScript.
' Example script to create a user called Guido in OU Worcester ' Note the domain cp.com
should be changed.
Set objOU = GetObject("LDAP://OU=Worcester,dc=cp,dc=com")
Set objUser = objOU.Create("User", "cn=GuidoT")
objUser.Put "sAMAccountName", "GuidoT"
objUser.Put "givenName", "Guido"
objUser.Put "initials", "A.G."
objUser.Put "sn", "Thomas"
objUser.Put "displayName", "Guido Thomas"
objUser.SetInfo
Set objOU = GetObject This statement references the correct
container or organizational unit in Active Directory. You will need to
change the ("LDAP://OU = Worcester, dc=cp, dc=com") to reflect your domain and
your OU.
Set objUser = objOU.Create This statement tells Active Directory
that you wish to add a user object (not a computer object) and that you want to
create not delete.
objUser.Put This is the best way to add the attributes of the
user GuidoT.
SetInfo means write the objUser into Active Directory
'
' VBScript.
' To SET a user's password.
Set objUser = GetObject _
("LDAP://cn=GuidoT,ou=Worcester,dc=cp,dc=com")
objUser.SetPassword "gU1d0*!"
Learning Points
The key method here is SetPassword. Best practice is to use UPPER case,
lower case, numbers and even non-alphanumeric characters so that the passwords
are very difficult to guess, for example STL01isRams. If your password
policy is less strict then suggest that they use phrases in their
passwords, for example (ST Louis Rams).
'
' VBScript.
' To CHANGE a user's password. N.B. you must know the original password
Set objUser = GetObject _
("LDAP://cn=GuidoT,ou=Worcester,dc=cp,dc=com")
objUser.ChangePassword "gU1d0*!", "ant0n10#!"
Learning Points
The above script will change a password but only if you already know the
existing password. Notice a different method ChangePassword here,
compared with SetPassword in 2) Setting the User's password in the middle script.
In this Ezine you learnt how to set or change a users password. The
technique uses to key methods, objUser.ChangePassword and objUser.SetPassword.
We also had a refresher on the .put and .Setinfo methods of adding or amending
user's properties. See more on setting passwords here
Their topics and material are ideal for getting you started with VBScript. The
videos are easy to follow and you can control the pace. Try their free demo material and then see if you want to buy the full package.
See more about VB Script Training CD.
|