Extending Bulk Password Control (Tools)

 

Adding tools to the Bulk Password Control dialog is very similar to adding tools to the main Password Control dialog.  You add VBS Script files to the "BulkScripts" folder in the Password Control program directory.  The scripts will appear in the "Tools" menu in the Bulk Password Control dialog.

There are some important differences though.  In the Extending Password Control section there is an example of a script that will launch the "Active Directory Users and Computers" MMC.  If you add this script to the "BulkScripts" folder you might not get the results you are expecting.  The script will run once for each user account selected, opening up multiple copies of the MMC.

Another difference is that the script is run in "CSCRIPT" mode.  If you write any "wscript.echo" statements in your script you won't see an interactive prompt.  The output from the script will be stored in the "Status" column for each user account.  If you hover your mouse cursor over this column, the full text will be displayed. 

The last thing to note is that the script will return a result of "Succeeded" if no unhandled errors occur in the script.  If you choose to handle the error in the script and use a "wscript.echo" statement to display a friendly message that the script has failed, the script will return a result of "Succeeded".  I suggest that you use error handling only if you need to perform cleanup operations after an error occurs in the code.  I'd also suggest that if a script has logically failed at some point that you use the "Err.Raise" method to report the failure.

Example 1

In this example we will add an option to set the "User Must Change Password At Next Logon" option to true.

ADsPath = wscript.arguments.named.item("ADsPath")

' Bind to the user object
set objUser = getobject(ADsPath)

'<<<< Enable User must change password at next logon >>>>
objUser.put "pwdLastSet", 0
objuser.setinfo
 

Example 2

In this example we will add an option to set the "User Must Change Password At Next Logon" option to false.

ADsPath = wscript.arguments.named.item("ADsPath")

' Bind to the user object
set objUser = getobject(ADsPath)

'<<<< Disable User must change password at next logon >>>>
objuser.put "pwdlastset", -1
objuser.setinfo
 

 



Password Control 

Product Home
 Download
Password Control
Bulk Password Control
Bulk Modify
General
User Comments
Report a Bug
Suggest a new feature
Press!
Registration Code