Solved

powershell command exchange 2010

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

20 Experts available now in Live!

Get 1:1 Help Now