Avatar of techdrive
techdriveFlag for United States of America

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"}
PowershellExchange

Avatar of undefined
Last Comment
techdrive
Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland image

$mailboxes=import-csv C:\temp\mailusers.CSV
ForEach ($mailbox in $mailboxes)
{
  Enable-Mailbox -Identity $mailbox.user -Database $mailbox.mailboxdatabase –Archive -ArchiveDatabase $mailbox.mailboxdatabase
}
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of techdrive
techdrive
Flag of United States of America image

ASKER

You are a genius thanks again
Exchange
Exchange

Exchange is the server side of a collaborative application product that is part of the Microsoft Server infrastructure. Exchange's major features include email, calendaring, contacts and tasks, support for mobile and web-based access to information, and support for data storage.

213K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo