Schedule Mailbox Move
I need to move thousands of mailbox during off hours. I won't be able to move all of them in one night so I wanted to schedule them. How can I schedule a mailbox move command to run afterbusiness hours. I would also like to know how to use the powershell command to pull from a txt file or csv file my list of mailboxes? Thank you and Happy Holidays. :)
December 24th, 2008 10:09pm

Hi,Yes this can be done by using a Powershell script and schedule it via scheduled task to run. Although it's another command the following tutorial describes how to schedule a Powershell script:http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/About the question how to get the users from a txt/csv see this site:https://blogs.wharton.upenn.edu/bubblewrap/2008/05/how-to-move-mailboxes-from-a-t.htmlPlease let me know if this will anwer your question.Regards,Johan blog: www.johanveldhuis.nl
Free Windows Admin Tool Kit Click here and download it now
December 25th, 2008 12:46am

Perfect procedure John.Hi Russell,Just want to add some of the things to keep in mind while using Move-Mailbox with Import-CSV command.1. If you want to move the mailboxes to different databases of a server then you can put alias as well as TargetDB name into CSV file to move the mailboxes. Your csv file would be like below...Alias,TargetDBUser1,ServerName\StorageGroupName1\DatabaseName1User2,ServerName\StorageGroupName2\DatabaseName2User3,ServerName\StorageGroupName3\DatabaseName3And your command would be like below to take Alias and TargetDB from CSV file.Import-CSV move.csv | ForEach { Get-Mailbox $_.Alias | Move-Mailbox -TargetDatabase $_.TargetDB} 2. Make sure that you have added Confirm switch with Move-Mailbox CmdLet, otherwise it will stop to receive confirmation whilemoving.Import-CSV move.csv | ForEach {Get-Mailbox $_.alias | Move-Mailbox -TargetDatabase $_.TargetDB -Confirm:$False}3. If mailbox limit, of Exchange 2003 source mailboxes, is set on indivudial users then add -PreserveMailboxSizeLimit switch so it will remail same after movement otherwise it cahnges as per setting of limit set on Exchange 2007 database.Import-CSV move.csv | ForEach {Get-Mailbox $_.alias | Move-Mailbox -TargetDatabase $_.TargetDB -PreserveMailboxSizeLimit:$true -Confirm:$False}Before putting this in production I would suggest you to test couple of mailboxes using this scheduled script.Hope these help...! Let us know if you stuck anywhere while configuring this, we will glad to assist you :) Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
December 25th, 2008 10:06am

http://www.scriptinganswers.com/forum2/forum_topics.asp?FID=31I hope this doesn't come to late to help, i've been busy.Phil Braniff
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2009 8:03pm

Hi Amit! Saw your post here: http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/ Curious how you would do this in PowerShell 2.0 with Exchange 2010. I am trying to run a backup job through PowerShell. If I run the script using EMS it works fine and I get an email. When I run it using Task Scheduler the email never arrives, although the backup job completes. Below is what I am doing. First, I run a batch script (backupbatch.bat) which is kicked off by Task Scheduler: PowerShell.exe -command ". 'C:\Exchange Server\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\BackupScripts\backupscript.ps1" which runs backupscript.ps1: $ImportFile = "C:\BackupScripts\Input.txt" $OutputErrorFile = "C:\BackupScripts\Errors.csv" $msgSMTPServer = "email.server.org" $MsgRecipients = "Admin 1 <admin1@org.org>" $msgSubject = "Backup Failures" $msgSubject2 = "Backup Script Completed on " $MsgBody = "" $msgFrom = "MailboxServer@org.org" $localComputer = ($env:computername).ToUpper() $ArrayBackupInputALLServers = import-csv $ImportFile $ArrayBackupInputs = ($ArrayBackupInputAllServers | where {$_.ExchangeServer -eq $localcomputer}) foreach($ArrayBackupInput in $ArrayBackupInputs) { $strDatabase = $ArrayBackupInput.Database $BackupServerVolume = $ArrayBackupInput.($localcomputer + "Volume") If ($strDatabase -notlike "*PFDB0*") { If ((Get-MailboxDatabase -Identity $strDatabase -status).Mounted) { wbadmin.exe start backup -backupTarget:D: -include:$BackupServerVolume -vssFull -quiet } else { $MsgBody += "Backup failure for $strDatabase `n" } } ElseIf ($strDatabase -like "*PFDB0*") { If ((Get-PublicFolderDatabase -Identity $strDatabase -status).Mounted) { wbadmin.exe start backup -backupTarget:D: -include:$BackupServerVolume -vssFull -quiet } else { $MsgBody += "Backup failure for " + $strDatabase + " on server " + $ArrayBackupInput.ExchangeServer + "`n" } } } $arrEventBackupFailure = (Get-EventLog -LogName Application -After (Get-Date).AddHours(-12) -Source MSExchangeIS | where {$_.EventID -eq 9782}) If ($arrEventBackupFailure.count -gt 0) { $arrEventBackupFailure | Export-CSV -path $OutputErrorFile -Force } If (($MsgBody -ne "") -and ($arrEventBackupFailure.count -gt 0)) { Send-MailMessage -SmtpServer $msgSmtpServer -To $MsgRecipients -Subject $msgSubject -Body $MsgBody -From $MsgFrom -Attachments $OutputErrorFile } ElseIf ($MsgBody -ne "") { Send-MailMessage -SmtpServer $msgSmtpServer -To $MsgRecipients -Subject $msgSubject -Body $MsgBody -From $MsgFrom } Else {Send-MailMessage -SmtpServer $msgSmtpServer -To $MsgRecipients -Subject ($msgSubject2+$localcomputer) -Body "Backup Script Ran...Yeah" -From $MsgFrom}
December 28th, 2010 7:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics