This spreadsheet is for the bulk changing or creation of Exchange Mailboxes. The Mailboxes 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 mailbox details read from the homemdb attribute in columns F to J.

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 create or move a mailbox on an Exchange Server. Rollback.ps1 will contain a complete reversal script that reverts the mailboxes back to their original state.

Clear

Clears the contents of columns F and higher leaving the column headers intact

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

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

  • Common Name
  • Samaccountname
  • Distinguished name

Populate the objects of the desired type that are to be read in column E and select the "Read" button.

Distinguished names will be read directly and offer the best performance in large directory structures. Common names or Samaccountname need to have their distinguished names queried and there is small time delay for each object in performing this lookup.

The error result of the reading objects will be displayed in column D:

Result

 

OK

The object has been read successfully

Not found

The object or attribute cannot be found

Error

There is an error reading the object or attribute

The details read from the objects homemdb attribute will be populated in columns E through J

Result

 

Mailbox Store (F)

The exchange mailbox store where the users mailbox resides

Storage Group (G)

The storage group where the mailbox store resides

Server (H)

The Exchange server that contains the mailbox of the user

Administrative Group (I)

The administrative group of the exchange server

Organization (J)

The organization for the AD of the users

Updating objects 

Populate the names of the objects to have their mailbox updated in column E

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

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

  •    Common Name
  •    Samaccountname
  •    Distinguished name

Populate the names of the Mailbox Store column F and the Server Column G. (Only columns E, F and G need populating to update a mailbox)

Once the spreadsheet is populated set Excahnge object B17 to either 2007 or 2010 depending on the version of exchange server you are running, powershell commands vary slightly between versions.

Select update, if the object specified already has a mailbox a move mailbox command will be scripted to the target Mailbox store and server. If the object specified doesn't have a mailbox them a create command will be scripted.

The update.ps1 and rollback.ps1 sheets will be deleted and recreated with powershell scripts that can be used to update objects.

Generating and executing powershell scripts

Once the spreadsheet is populated with objects and target mailstore and server specified select the Update button.

The worksheets "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.