Extending Password Control (Tools)
Password Control can be extended by adding VBS script files in the "Scripts" folder
of the Password Control application directory. These Scripts will appear in
a "Tools" menu in the Password Control application.
Example 1 - Adding a "Delete User" option
In this example we will write a VBS Script to delete the selected user account in
Password Control. Password Control will enumerate all the VBS files in the
"Scripts" folder and display them as options in the tools menu. Password Control
will pass the ADsPath of the current user to the script, allowing us to know which
user is currently selected.
ADsPath = wscript.arguments.named.item("ADsPath")
if ADsPath = "" then
msgbox "Please type the name of the user to delete in the Password Control username textbox",vbOkOnly+vbExclamation,"Username required"
wscript.quit
end if
set objUser = getobject(ADsPath)
result = msgbox("Are you sure you want to delete this user account?" & vbcrlf & _
objUser.sAMAccountName,vbyesno+vbExclamation,"Confirm Delete")
if result = vbYes then
set objContainer = getobject(objUser.Parent)
objContainer.Delete "user","cn=" & objUser.cn
msgbox "User account deleted successfully",vbOkOnly+vbInformation
end if
Example 2 - Adding a shortcut to Active Directory Users and Computers
In this example we don't need to verify if a valid user has been selected in Password
Control.
set objShell = createobject("Wscript.Shell")
objShell.Run "dsa.msc"