Solved

How do use New-MailboxExportRequest to see if a mailbox is being exported, if so, wait for it to finish.

Posted on 2016-08-25
3
38 Views
Last Modified: 2016-08-31
I am writing a powershell script that uses Get-MailboxExportRequest to export out mailboxes.  Before I call Get-MailboxExportRequest, I want to confirm there are no other request running for the same account.  If there are, I would like to wait.

I have written the code below that waits if there is an existing MailboxExportRequest.  However, my issue is if there is not, this sits in an endless loop.  

while(!(Get-MailboxExportRequest -Mailbox $mailBoxName.Alias -Status Completed))
{
	Sleep -s 300
}

Open in new window


Does anyone have a suggestion?  Many Thanks!
0
Comment
Question by:rye004
[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
  • 2
3 Comments
 

Accepted Solution

by:
rye004 earned 0 total points
ID: 41771130
I think I figured this out.  I need to use an IF statement before using the while loop.  Below is the code:

if((Get-MailboxExportRequest -Mailbox $mailBoxName)){
	while(!(Get-MailboxExportRequest -Mailbox $mailBoxName.Alias -Status Completed))
	{
		Sleep -s 300
	}
}

Open in new window

0
 
LVL 11

Expert Comment

by:Tej Pratap Shukla ~Dexter
ID: 41771278
Hi,
You can go through below link to learn about execution of New-MailboxExportRequest Command. You can some live running command images with proper configuration as well as requirement.

http://exchange-server-guide.blogspot.com/2016/03/how-to-export-edb-mailbox-to-pst.html
0
 

Author Closing Comment

by:rye004
ID: 41777758
I was able to figure this out after posting.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

751 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