Solved

powershell command exchange 2010

Posted on 2014-04-25
4
176 Views
Last Modified: 2014-10-25
I am mass moving a bunch of users and wondering if there is a way I can tweak this command to email me once the job finishes moving the mailboxes on exchange.



Open in new window

Import-CSV "c:\temp\massmoves3.csv" | foreach {New-MoveRequest -Identity $_.displayname -Target
Database $_.database}

Open in new window

0
Comment
Question by:techdrive
4 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40023099
Sending the mail isn't difficult (pointer: Send-MailMessage), but waiting for the asynchronous move requests to finish is. We have to wait until there is no further task queued or in progress.
Import-CSV "c:\temp\massmoves3.csv" | foreach {
  New-MoveRequest -Identity $_.displayname -TargetDatabase $_.database
}
while ((Get-MoveRequest -MoveStatus Queued) -or (Get-MoveRequest -MoveStatus InProgress))
{
   start-sleep 15  # seconds
}
Send-MailMessage -SmtpServer mx.MyCompany.Com -From Me@MyCompany.Com -To Me@Mycompany.Com -Subject 'Finished Mailbox Move Requests'

Open in new window

0
 

Author Comment

by:techdrive
ID: 40023371
Qlemo you are a genius thanks
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Set OWA language and time zone in Exchange for individuals, all users or per database.
A procedure for exporting installed hotfix details of remote computers using powershell
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 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