July 2017
Intermediate to advanced
648 pages
31h 9m
English
Let's look at an example of creating mailbox databases in bulk. This can be helpful when creating many databases. The following code can be used for doing the job:
$data = Import-CSV .\DBs.csv
foreach($row in $data) {
$DBName = $row.DBName
$LogPath = 'E:\Databases\' + $DBName + '\Logs'
$DBPath = 'E:\Databases\' + $DBName + '\Database\' + $DBName + '.edb'
$Server = $row.Server
New-MailboxDatabase -Name $DBName -Server $Server -Edbfilepath ` $DBPath -Logfolderpath $LogPath
}
foreach($row in $data) {
$DBName = $row.DBName
Mount-Database $DBName
}
In this example, we create an array by importing a CSV file. We start looping through each row in the file; also in the loop we create new variables named DBName, LogPath ...
Read now
Unlock full access