Exchange 2007 create new Storage Groups with Mailbox Database

After a default Exchange 2007 SP1 installation, there is one Storage Group with one Mailbox Database available and mounted. You have to change the logfile path and database path manually. If you use the following script, you can create one, two, three, four (or more) Storage Groups and Databases fully automatic. Let’s say you’ve installed a new Exchagne 2007 server with three partitions.

————————————————
# This script creates two storage groups named SG1 and SG2, with mailbox stores MB1 and MB2, and finally mounts them.
# C: – Operating System
# D: – Exchange Logfiles/Systemfiles
# E: – Exchange Databases

# Environment variables
$server = “srv-ex01”
$logfilepath = “D:\Log”
$mbxfilepath = “E:\Database”

# Creating the Storage Groups and Mailbox Stores
foreach (
$i in (1,2,3,4)
){
new-storagegroup -name SG$i -server $server -logfolderpath “$logfilepath\SG$i” -systemfolderpath “$logfilepath\SG$i”
}
foreach (
$i in (1,2,3,4)
){
new-mailboxdatabase -storagegroup $server\SG$i -name MB$i -edbfilepath “$mbxfilepath\MB$i\MB$i.edb”
mount-database MB$i
}
————————————————

Leave a Reply