• Homepage
  • Group Policy
  • VBScript
  • Videos
  • Windows 7
  • PXE
  • Shutdown
  • Modifying Active Directory Objects via VBScript

    VBscript is a powerful scripting language that can be used to automate the modification of Active Directory Objects such as Users and Computers.

    I have created a collection of scripts that will pull lists of users or computers into Excel, will read an Excel spreadsheet and modify user information in Active Directory accordingly, and will add hundreds of users to Active Directory automatically.

    These are only templates. You will need to modify the scripts for your Domain. If you are new to scripting it may be a bit confusing at first. However, read the scripts carefully and change any Domain names to match your domain and OU/Group names to match your OU and Group names.

    Adding Users from an Excel Spreadsheet to Active Directory

    With this script you need to setup your XLS spreadsheet first. You can import your data from another database or enter it manually. You will need to fill in all columns or leave them blank. There are options for adding other User Properties but you would need to modify the VBScript and add the column to the XLS spreadsheet. The column numbers are referenced in the VBScript so make sure if you change columns, that you change the vbscript. To Run the script, either double click on it and find the XLS file or drop the XLS file right onto the script.

    Querying Active Directory and Exporting User Data into Excel Spreadsheet

    With this script your XLS spreadsheet is blank. Just create a blank XLS sheet and either drop it onto the VBS script or double click the VBS script and choose the XLS file. You MUST modify the OU and the Domain. If you want to search the entire domain, then remove the OU listed. This is a top-down approach so you can choose your subset based on the LDAP listing that you place in the VBS script.

    Taking Data from and Excel Spreadsheet, querying Active Directory and then updating the User Information if the user is found

    With this script your XLS spreadsheet has the logon name, first name, last name and updated data. Please leave the 2nd column BLANK for the VBSscript to put the "found" or "not found". The script will search via username (samaccountname) and will update the user with the new data in the columns. The data to update MUST be specified in the VBScript along with the column where the data resides.

    You MUST modify the OU and the Domain. If you want to search the entire domain, then remove the OU listed. This is a top-down approach so you can choose your subset based on the LDAP listing that you place in the VBS script.

    Searching Active Directory for logon names listed in an Excel Spreadsheet, and then if the users are found, moving them to dedicated OU.

    With this script your XLS spreadsheet has the logon name and a space for "Found". This script will search ALL of Active Directory for the Username and then move that User to a specific OU.

    This is extremely useful for moving users who have left and also moving users who need specific profiles

    You MUST modify the Target OU and the Domain. This is a top-down approach so you can choose your subset based on the LDAP listing that you place in the VBS script.