Solved

PowerShell for moving mailbox

Posted on 2013-02-02
3
526 Views
Last Modified: 2013-02-07
We have a standard Storge Group with 2 different mailbox storage.

Is it possible to write a powershell to automate

1. Create a Temporary Storage Group
2. Move each mailbox storage to the Temporary Storage
3. Remove the old Standard Storage Group and Recreate a new one
4. Move each mailbox storage back to Standard storage Group
5.  Remove the Temporary Storage Group.

When we remove the Storage Group, do we need to stop the Information Storage ? Is it possbiel to automate the process ?

Tks

5.
0
Comment
Question by:AXISHK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
coraxal earned 500 total points
ID: 38848106
I'm sure you have your reasons for deleting the standard SG. Also, I think in steps 2 & 4 you mean "Mailbox databases" instead of "Mailbox storage".  In any event, the script you're trying to get would look something like this: (note: this is script is untested and you should test it in a test environment before running in production)
# Create a Temporary Storage Group
$LogFolderPath = "D:\Mailbox\Temporary Storage Group"
$SystemFolderPath = "D:\Mailbox\Temporary Storage Group"
$TmpStorageGroupName = "TemporaryStorageGroup"
New-StorageGroup -Name $TmpStorageGroupName -Server "ExchangeServer1" -LogFolderPath:$LogFolderPath -SystemFolderPath:$SystemFolderPath

# Dismount existing databases
$CurrentMailboxDatabases = "MailboxDB1","MailboxDB2"
foreach ($MailboxDatabase in $CurrentMailboxDatabases)
{
	Dismount-MailboxDatabase -Identity $MailboxDatabase -Confirm:$false
}

# Move existing databases to temporary SG
foreach ($MailboxDatabase in $CurrentMailboxDatabases)
{
	Move-DatabasePath -Identity $MailboxDatabase -EdbFilePath $("D:\Mailbox\Temporary Storage Group\$MailboxDatabase" + ".edb") -Confirm:$false
}

# Remove current standard Storage Group
$StorageGroup = "StandardStorageGroup"
Remove-StorageGroup -Identity $StorageGroup -Confirm:$false

# Create new standard Storage Group
$LogFolderPath = "D:\Mailbox\Standard Storage Group"
$SystemFolderPath = "D:\Mailbox\Standard Storage Group"
New-StorageGroup -Name $StorageGroup -Server "ExchangeServer1" -LogFolderPath:$LogFolderPath -SystemFolderPath:$SystemFolderPath

# Move existing databases to new standard SG
foreach ($MailboxDatabase in $CurrentMailboxDatabases)
{
	Move-DatabasePath -Identity $MailboxDatabase -EdbFilePath $("D:\Mailbox\Standard Storage Group\$MailboxDatabase" + ".edb") -Confirm:$false
}

# Mount existing databases
foreach ($MailboxDatabase in $CurrentMailboxDatabases)
{
	Mount-MailboxDatabase -Identity $MailboxDatabase -Confirm:$false
}

Open in new window

0
 
LVL 5

Expert Comment

by:coraxal
ID: 38848109
Sorry, forgot to answer you question about stopping services.  You do not need to stop any services including the Information Store service when removing a storage group
0
 

Author Closing Comment

by:AXISHK
ID: 38866465
Tks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question