Link to home
Start Free TrialLog in
Avatar of rye004
rye004Flag for United States of America

asked on

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

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!
ASKER CERTIFIED SOLUTION
Avatar of rye004
rye004
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of rye004

ASKER

I was able to figure this out after posting.