Solved

powershell command exchange 2010

Posted on 2014-04-25
4
174 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 68

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Synchronize a new Active Directory domain with an existing Office 365 tenant
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now