Bulk AD account and mailbox creation with Powershell
I am looking for a Powershell script that will create the AD account and them mailbox enable that account based on a csv file. We have Windows 2003 domain and Exchange 2007 SP1.
I know I have seen good examples, but cant seem to find them now.
Can you help?
May 11th, 2010 6:13pm
The new-mailbox cmdlet will do both. Here's a good example:
http://exchangepedia.com/blog/2006/11/exchange-server-2007-bulk-creation-of.html
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2010 6:18pm
in addition to mike pfeiffer's response
the set-user cmd can modify specific AD attributes that might not be able to be set via new-mailbox.
http://technet.microsoft.com/en-us/library/aa998221(EXCHG.80).aspx
you could also go thru ldap to set up user, or thru the qad cmds (new-qaduser) if that plugin is installed, then add a mailbox with the enable-mailbox command.
May 11th, 2010 8:45pm
This will get your users created by csv, maybe have the all the user values you want added to the account in the csv, ie: name, surname, givenName, sAMAccountName, UPN, etc..
Im not sure on how to create the mailbox in exchange 2003...sorry
$csvFile = 'path to csv file'
$objOU= "OU=Go,OU=Browns,DC=domain,DC=com"
$class= "User"
Import-Csv -Path $csvFile | ForEach-Object -Process {
$stName = ($_.Name)
$strCN= ("CN="+$stName)
## $strSurname = $_.SurName
## Assign the attributes to a variable, although could use just the $_.value in the put commands below.
## CREATE User
$adsi= [ADSI]("LDAP://doaminController.domain.com/"+$objOU)
$objUser= $adsi.Create($class,$strCN)
$objUser.setInfo()
## SET User ATTRIBUTES
$objU= [ADSI]("LDAP://doaminController.domain.com/"+$strCN+","+$objOU)
$objU.put("attribute", "value")
$objU.put("attribute", "value")
$objU.put("attribute", "value")
$objU.put("attribute", "value")
$objU.put("attribute", "value")
$objU.setInfo()
## Clear Variables
$stName = $null;$strCN = $null,$objU=$null;$objUser =$null
}
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2010 3:23pm
this might be of assistance
http://www.codeguru.com/csharp/csharp/cs_internet/mail/article.php/c14009/
need exchange system manager on workstation
or this shows how to do without.
http://www.vistax64.com/powershell/85289-how-create-mailbox-exchange-2003-using-powershell.html
I havent tested any of this.
May 12th, 2010 3:36pm