• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

How do I create a new mailbox and set the properties using Exchange Management Shell?

I have to create a bunch of new users. To make things easier (and a lot faster) I am using a simple batch script.  I am using set to set some enviroment values.(ex. set account=johndoe)

I know how to create a new mailbox using the Exchange Management Shell but is it possible to use/push the enviroment settings (used in the batch script) to the Exchange Management Shell?

Example:

The batch file contains the following enviroment settings:

set firstname=John
set surname=Doe
set account=johndoe

These enviroment settings should be used to create the new mailbox in the Exchange Management Shell:

Enable-Mailbox -Identity 'domain.local/Administration/%firstname% %surname%' -Alias '%account%' -Database 'SERVER\First Storage Group\Mailbox Database'

I'm a noob when it comes to powershell/management shell so I would greatly appreciate it if someone could tell me how to achieve this.

Thanks in advance!
Clyde.
0
Clyde_Radcliffe
Asked:
Clyde_Radcliffe
2 Solutions
 
leonov_alexCommented:
Accessing to environment variables in powershell:
[PS] C:\Windows\system32>$env:systemroot
C:\Windows

Open in new window

0
 
shauncroucherCommented:
My article for creating mailboxes using settings from a CSV may help you here:

http://exchangeshell.wordpress.com/2009/08/05/bulk-create-users-for-exchange-2007-testing/

Shaun
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now