This spreadsheet is for the bulk moving and renaming of Active Directory objects. The Objects will not be accessed directly, the spreadsheet will generate powershell scripts that can be executed by administrators.

The control buttons on the left hand side perform the following function:

Button

Functionality

Read

Will  read the objects specified in column E sequentially populating the LDAP attributes specified as row headers, column F and Higher. This provides the same functionality as the AD_Query spreadsheet.

Update

Will generate two Excel sheets called "Update.ps1" and "Rollback.ps1". Update.ps1 contains a powershell script that can be used by an administrator, The script will contain a series of commands that move or rename the objects in column D, New names are in column E. Rollback.ps1 will contain a complete reversal script that reverts the objects back to their original state.

Clear

Clears the results from columns F

leaving the column header intact

When reading Objects specified in column D objects will be read sequential starting in cell D2 and continuing in column D until an empty cell is found.

Objects can by specified in cell "B15" by Either;

  •     Common Name
  •          Distinguished name

If Common Name is chosen then Source and Target OU's must be specified in cells "B16" and "B17"

 

Updating objects

Populate the names of the source objects in column D and the names of the target objects in row E. If the objects need to be validated select read.

If specifying common names and not renaming, only moving the objects between OU's then column E may remain blank, if specifying distinguished names or common names and renaming then column E must be populated,

Once read is selected the following will be displayed in the results column:

Result

 

Source Object Found

The source object is validated and currently exists

Target Object Found

The source object does not exist however the target object does, this would validate a successful object move

Object Not found

The object cannot be found in either source or target location or name the spreadsheet has been incorrectly populated

 

Generating and executing powershell scripts 

Once the spreadsheet is populated with objects and attribute values select the Update button.

The tabs."Update.ps1" and "Rollback.ps1" will be created or if already there deleted and recreated.

Send the spreadsheet to your AD administrator to perform the following activities:

 Copy the scripts to text files

Within the "update.ps1" sheet highlight column A, right click and select copy.

Create a new text file e.g. c:\script\update.ps1

Paste the contents of column A into the text file, either use notepad or a powershell editor.

 Save the file and repeat for "rollback.ps1"

The powershell script update.ps1 can now be run at a command line or within a powershell editor

 

Once update.ps1 is run, there will be no output on the command line if the script executes without error. Errors will be outputted in red text. The script will output the csv file into its execution directory called Result.csv.

For each object processed the following results will be outputted:

Column

Result

Object

The name of the object that has been processed in the script

Error

An integer counting the number of errors processing the object in the script, If 0 Then No Error

Description

Description , The description of the last error processing the object in the script, If Empty then No Error

If a rollback is required then the rollback.ps1 script can be run.

Selecting read can validate if the move has been successful.