Thursday, June 14, 2007

Create Bulk users with TXT File Exchange 2007 PART#1



I am getting used to this new Exchange management shell (EMS); and I start enjoying it the more I can make my own discoveries and make my life easier. This tip is for total baby beginners. I quickly realized and enjoying it with new MMC 3.0, new EMS (exchange management shell) shows you at the end of each task execution brief summary. This summary is totally, can be copy to a note pad or word application. First of all we will create a user by using GUI and look trough the code and get some learning points. If you like to read more about the management Shell read here. Honestly it is a challenging at the very first time to deal with the new Shell for those who are not script person (I am one of them). The point I am trying to make is that, creating a mailbox was possible with some hundred codes before, now it can be done with two lines. Also each time we perform a task, creating users, group's ant etc, at the very end we get a summary of what code in shell has been executed and copy it and making some changes and reusing it. I think this is a great learning Chance for us first time in the Microsoft history. We are able to see what is happening in the background and we can generate the same and Bulk operation same as the code itself.

We click on new user and now we will have to fill out bunch of Empty Fields, as shown below




What we interested in is the Exchange Management Shell command, which is the same as what we have done with GUI, ESM.

Summary: 1 item(s). 1 succeeded, 0 failed.

Elapsed time: 00:00:01

 
 

Exchange01

Completed

 

Exchange Management Shell command completed:

New-Mailbox -Name 'Exchange01' -Alias 'Exchange01' -OrganizationalUnit 'smtp25.org/Users'

-UserPrincipalName 'Exchange01@smtp25.org' -SamAccountName 'Exchange01' -FirstName 'Exchange01'


-Initials '' -LastName 'Msexchange' -Password 'System.Security.SecureString' -ResetPasswordOnNextLogon $false -Database 'CN=SG3-MB1,CN=SG3,CN=InformationStore,CN=EXC07,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=smtp25,DC=org'

 

Elapsed Time: 00:00:01


 

So I am going to copy and paste here one more time the command


 

New-Mailbox -Name 'Exchange01' -Alias 'Exchange01' -OrganizationalUnit 'smtp25.org/Users'

-UserPrincipalName 'Exchange01@smtp25.org' 'Exchange01' -FirstName 'Exchange01'

–Initials '' -LastName 'Msexchange' -Password 'System.Security.SecureString'-ResetPasswordOnNextLogon

$false -Database 'CN=SG3-MB1,CN=SG3,CN=InformationStore,CN=EXC07,CN=Servers,CN=Exchange

Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft

Exchange,CN=Services,CN=Configuration,DC=smtp25,DC=org'


 


 


 

If you can see the pattern from below table each line (Parameter), starts with – (dash) and following with command. After each Parameter there is an Apostrophe 'Value or data' and closing Apostrophe. All other lines will follow the same pattern. This is what we need to keep memories to make our lives less painful going trough learning Command-lets

New-Mailbox –Name

'Exchange01'

  • -Alias
  • 'Exchange01'
  • -OrganizationalUnit
  • 'smtp25.org/Users'
  • -UserPrincipalName
  • 'Exchange01@smtp25.org' 'Exchange01'
  • -FirstName
  • 'Exchange01'
  • –Initials
  • No data
  • -LastName
  • 'Msexchange'
  • -Password
  • 'System.Security.SecureString'
  • -ResetPasswordOnNextLogon
  • -ResetPasswordOnNextLogon $false
  • -Database
  • 'CN=SG3-MB1,CN=SG3,CN=InformationStore,CN=EXC07,CN=Servers,CN=Exchange
  • Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft
  • Exchange,CN=Services,CN=Configuration,DC=smtp25,DC=org'


 

Let's take a look at some of the parameters which are required to complete the creating a mailbox task. Some of these are optional.

To run the New-Mailbox cmdlet, the account you use must be delegated the following:

  • Exchange Recipient Administrator role
  • Account Operator role for the applicable Active Directory containers 

Here is the example from TechNet

The first example shows how to create a user Chris Ashton in Active Directory and create a mailbox for the user. The mailbox is located on Storage Group 1, in Mailbox Database 1. The password must be reset at the next logon. To set the initial value of the password, this example creates a variable, $password, prompts you to enter a password, and assigns that password to the variable as a SecureString object.


 

The second example shows how to create a user in Active Directory and a resource mailbox for a conference room. The resource mailbox is located on Storage Group 1, in Mailbox Database 1. The password must be reset at the next logon. The Exchange Management Shell will prompt for the value of the initial password, because it is not specified.



 

$password = Read-Host "Enter password" -AsSecureString New-mailbox -UserPrincipalName chris@contoso.com -alias chris -database "Storage Group 1\Mailbox Database 1" -Name ChrisAshton -OrganizationalUnit Users -password $password -FirstName Chris -LastName Ashton -DisplayName "Chris Ashton" -ResetPasswordOnNextLogon $true New-Mailbox -UserPrincipalName confmbx@contoso.com -alias confmbx -name ConfRoomMailbox -database "Storage Group 1\Mailbox Database 1" -OrganizationalUnit Users -Room -ResetPasswordOnNextLogon $true


 

Part 2 we will create Bulk mailboxes from TXT files.

Thanks

Oz


 


 


 


 

2 comments:

computer troubleshoot said...

How to create bulk users in windows 2003 exchange server?
IS there any tools please share

kns said...

Hello
I have already created the bulk exchange 2007 mailboxes. I am now trying to create the AD Home folders for these mailboxes/users. Would you have any idea how I can get this done easily? Thanks for your helpful post.