Bulk AD Users – Extending


Bulk AD Users includes an array of features that make it one of the most useful tools for performing bulk updates to Active Directory user accounts.  This functionality can also be extended through the use of VBS scripts, allowing you to add highly customized behaviour to the application.  As an example, you might want to add an option that will create home folders for users and assign permissions to those folders. 

How it Works

The first step is to create a scripts subfolder in the Bulk AD Users application directory.  Any script files that you create in this folder with a *.VBS file extension will automatically be available to the application.  Any scripts added will appear in the scripts menu in the application as shown below: 

Bulk AD Users - Scripts Menu

 When you click to run a script, the script is run once for each user account in the grid. The application passes a couple of parameters to the script to enable your script to identify the user account that it needs to run for.  To reference the parameters in your script, simply use the following code in your VBS script file: Dim strADsPath, strUserNamestrADsPath = wscript.arguments.named.item(“ADsPath”)
strUserName= wscript.arguments.named.item(“sAMAccountName”) The ADsPath parameter gives you access to the full path to the user object in Active Directory, which you can use to bind to the user object using the code below: SET objUser = GETOBJECT(strADsPath) The user object can then be used to read any other attribute of the user account and it can also be used to perform updates.  If you only need access to the username you can get this from the “sAMAccountName” parameter without binding to the user account.


This example will demonstrate how to create home folders for user accounts and modify NTFS file permissions to grant the user full access to the new folder.  The example uses a command line tool called CACLS to modify the NTFS permissions.  The default parameters in the script will preserve any existing permissions and also grant the user full control to the folder.  If you would like to change this behaviour, please consult the CACLS documentation here.  

  • Save the script above as “Create Home Folders.vbs” inside the “scripts” folder in the Bulk AD Users application directory.
  • Run the Bulk AD Users application.
  • Select the user accounts that you want to create home folders for.
  • Ensure that the homeDirectory attribute is set for these user accounts – You might want to use one of the update features of the application (e.g. Bulk Modify) to specify a value for this attribute. 
  • Check that you are running as an account with sufficient permissions to create home folders and change ACL permissions.  Both NTFS and share permissions will be required.
  • Select the “Create Home Folders” option from the scripts menu.

Known Issues

  • The Bulk Modify Results dialog will appear if you have performed a previous update using the application.  Scripts run from Bulk AD Users do not produce a log file and the results that are shown are for the previous update.  The results dialog should be ignored if it is shown.