Powershell/Exchange Management Shell scripting help
First off, thanks to anyone who read and contributed to this...I know first hand how difficult deploying/upgrading a complex exchange infrastructure can be. With your help I can be one step closer to my final deployment. Thanks in advance.
I am trying to automate the creation of exchange mailboxes in our organization. To do this I have written a script to read information from a csv filethis csv file contains the identity, lastname, and firstname (see below, labeled CSV file).
The script (see below, labeled script) takes this information, creates a mailbox for the user (using a static server & database path), and populates the users active directory attributes for Firstname, lastname and displayname.
What I want (and what I need help with) is tomake the script intelligent enough to create the mailbox on a specific server\storage group\database based on the users last name (instead of using a static server\storage group\database path. The distribution criteria (see below, labeled Distribution Criteria) for mailbox placement is fairly simple For example, If the script was intelligent, it would create rommel99's mailbox in "muxc10\Fourth Storage Group\Mailbox Database".
CSV file
Identity,LastName,FirstName
domain\rommel99,rommel,erwin
Script
import-csv "V:\book1.csv" | foreach-object -Process {enable-mailbox -Identity $_.Identity -Database "muxc09\First Storage Group\Mailbox Database" | set-user -LastName $_.LastName -FirstName $_.FirstName -DisplayName "$($_.LastName),$($_.FirstName)"}
Distribution Criteria
Name
Server
Storage Group
A - Bark
MUXC09
First
Barn - Broz
MUXC09
Second
Brub - Col
MUXC09
Third
Com - Doy
MUXC09
Fourth
Doz - Gain
MUXC09
Fifth
Gal - Hay
MUXC09
Sixth
Hb - Jia
MUXC09
Seventh
Jim - Law
MUXC09
Eigth
Lay - Mayn
MUXC10
First
Mayo - Mue
MUXC10
Second
Mug - Pers
MUXC10
Third
Pert - Ruc
MUXC10
Fourth
Rud - Smith
MUXC10
Fifth
Sno - Toll
MUXC10
Sixth
Tom - Wilsk
MUXC10
Seventh
Wilso - Z
MUXC10
Eigth
October 4th, 2007 8:52pm