Quantcast
Channel: Exchange Server 2010 forum
Viewing all articles
Browse latest Browse all 8820

Would Someone Mind review this PS Script I Wrote for Mailbox Moves: 2007 - 2010

$
0
0

Because I don't if it's quite clear in what I'm attempting accomplish - the plan is that this script will grab mailboxes from a specified 2007 database with a pre-determined totalitemsize integer.  It will then move those mailboxes to the 2010 MB DB (I've tested this part of the script thoroughly and it does exactly what I need it to do).  Finally, as the move are queuing, being moved, and completely; I'd like to for script to create a log file and update it in real-time.

The problem I'm having - I can't seem to (and it may not be exactly clear below) get the log file to update in real time - and I'm not sure if the "Do / While" statement is correct in I'm trying to tell it to stop running $MoveStats after all moves are complete.  Can someone review the info below and let me know where I'm going wrong and/or offer some advice?  Feel free to make edits.  Thanks!!

$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
$MoveStats = Get-MoveRequestStatistics -MoveRequestQueue "2010DBName" | Out-File -FilePath "C:\MailboxMoves\InProcessMoves\$CurrentDate.txt" -append -noclobber

Get-MailboxDatabase 2007ServerName\sg2\db1 | Get-Mailbox | Where {$_.TotalItemSize -lt 100,000KB} | New-MoveRequest -TargetDatabase "2010DBName" -BadItemLimit 10

Do {$MoveStats}
Until ($MoveStats -eq "Completed" -or "Completed with warning" -or "Failed")


Viewing all articles
Browse latest Browse all 8820

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>