Solved

powershell command exchange 2010

Posted on 2014-04-25
4
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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