techdrive
asked on
Powershell adding archive database/passing database variable in script.
Guys,
This script basically takes input from a file with the two fields populated as such below. It then creates the user on the specified mailboxdatabase under the column. This is for an exchange 2010 environment. My challenge that I have is actually getting the archive database to be the same as the mailboxdatabase. How do I incorporate this in the script I have below many thanks
user, mailboxdatabase
user1 mbb00
user3 mbb5
user20 mbb6
$mailbox=import-csv C:\temp\mailusers.CSV
ForEach ($mailbox in $mailbox) {Enable-Mailbox -Identity $Mailbox.Identity -Database $Mailbox.Database | Enable-Mailbox –Archive -ArchiveDatabase "samedatabase"}
This script basically takes input from a file with the two fields populated as such below. It then creates the user on the specified mailboxdatabase under the column. This is for an exchange 2010 environment. My challenge that I have is actually getting the archive database to be the same as the mailboxdatabase. How do I incorporate this in the script I have below many thanks
user, mailboxdatabase
user1 mbb00
user3 mbb5
user20 mbb6
$mailbox=import-csv C:\temp\mailusers.CSV
ForEach ($mailbox in $mailbox) {Enable-Mailbox -Identity $Mailbox.Identity -Database $Mailbox.Database | Enable-Mailbox –Archive -ArchiveDatabase "samedatabase"}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are a genius thanks again
ForEach ($mailbox in $mailboxes)
{
Enable-Mailbox -Identity $mailbox.user -Database $mailbox.mailboxdatabase –Archive -ArchiveDatabase $mailbox.mailboxdatabase
}