Creating new linked mailboxes
Hi, I want to create bulk linked mailboxes on E2K7. I have a script which works fine for creating bulk linked mailboxes. $credential = Get-Credential Import-CSV .\users1.csv | foreach { New-Mailbox -Name $_.Name -Alias $_.alias -OrganizationalUnit $_.OrganizationalUnit -UserPrincipalName $_.UserPrincipalName -SamAccountName $_.SamAccountName -Database $_.Database -LinkedMasterAccount $_.LinkedMasterAccount -LinkedCredential $credential -LinkedDomainController 'ssaap3dom01.fontoso.com' -DisplayName $_.DisplayName -FirstName $_.FirstName -Initials $_.Initials -LastName $_.LastName} Problem is: I want to populate certain attributes too while creating linked mailboxes in single script. The attributes are as listed below Description,company,employeeID,department,title,telephonenumber,extensionAttribute1,extensionAttribute2,extensionAttribute3,mail,co,l,st,streetAddress,postalCode,physicalDeliveryOfficeName Also i want to add additional smtp address as @ABC.com. New users get stamped with @contoso.com by default but i want to have @ABC.com as primary smtp address and @contoso.com as secondary smtp address. Is it possible to achieve it in single script? I have another script as listed below to populate other attributes but stuck with proxyAddresses attribute. I couldn't get through it. $users = import-csv Users.csv foreach($row in $users) { $dn = $row.dn $user=[ADSI]"LDAP://$dn" $tel = $row.C $user.put("C", $tel) $user.SetInfo() $tel = $row.Co $user.put("Co", $tel) $user.SetInfo() $tel = $row.Company $user.put("Company", $tel) $user.SetInfo() $tel = $row.employeeID $user.put("employeeID", $tel) $user.SetInfo() $tel = $row.department $user.put("department", $tel) $user.SetInfo() $tel = $row.telephonenumber $user.put("telephonenumber", $tel) $user.SetInfo() $tel = $row.extensionAttribute1 $user.put("extensionAttribute1", $tel) $user.SetInfo() $tel = $row.extensionAttribute2 $user.put("extensionAttribute2", $tel) $user.SetInfo() $tel = $row.extensionAttribute3 $user.put("extensionAttribute3", $tel) $user.SetInfo() $tel = $row.proxyAddresses $user.put("proxyAddresses", $tel) $user.SetInfo() $tel = $row.l $user.put("l", $tel) $user.SetInfo() $tel = $row.st $user.put("st", $tel) $user.SetInfo() $tel = $row.streetAddress $user.put("streetAddress", $tel) $user.SetInfo() $tel = $row.postalcode $user.put("postalcode", $tel) $user.SetInfo() $tel = $row.physicalDeliveryOfficeName $user.put("physicalDeliveryOfficeName", $tel) $user.SetInfo() } Any help is appreciated. Shahid Note: I want to have single recipient policy as @contoso.com and manually want to add @ABC.com as primary smtp address through script.Shahid
April 20th, 2012 10:12am

I wouldn't do it with LDAP as you are attempting to do in the second script. I would assign all of the properties from CSV file into separate variables and then use Exchange Management Shell commands to populate them. Try changing your first script as follows: $Credential = Get-Credential -Credential "DOMAIN\USER_NAME"$Users = Import-CSV .\users1.csv ForEach ($User in $Users) { $Name = $User.Name $Alias = $User.Alias $OrganizationalUnit = $User.OrganizationalUnit $UserPrincipalName = $User.UserPrincipalName $SamAccountName = $User.SamAccountName $Database = $User.Database $LinkedMasterAccount = $User.LinkedMasterAccount $DisplayName = $User.DisplayName $FirstName = $User.FirstName $Initials = $User.Initials $LastName = $User.LastName New-Mailbox -Name $Name -Alias $Alias -OrganizationalUnit $OrganizationalUnit -UserPrincipalName $UserPrincipalName -SamAccountName $_.SamAccountName -Database $Database -LinkedMasterAccount $LinkedMasterAccount -LinkedCredential $credential -LinkedDomainController 'ssaap3dom01.fontoso.com' -DisplayName $DisplayName -FirstName $FirstName -Initials $Initials -LastName $LastName } You can certainly put the e-mail address generation into the script, but why not use an e-mail address policy for that instead? Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
April 29th, 2012 2:59pm

Thanks Ed for the script. Since we have all the domain in our Accepted Domains list and our company policy does not allow to have multiple recepient policies. We add them manually or by using script. I will test out your attached script in my LAB and revert back to you. How can i achieve the second part of my script by different method. Is there any script to achieve that?Shahid
April 29th, 2012 11:54pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics