Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

  • 2 months later...
Posted (edited)

Hi @sukh as New-MailboxExportRequest runs in the back ground if i empty the mailbox on the next powershell command will it clear the mailbox before the export has finished?

 

This is my script i want to use

 

Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.Admin"
$date = Get-Date -format "dd/MM/yyyy"
New-MailboxExportRequest -Mailbox SVC-EXCH-JOURNLING -FilePath "\\fp-itstorage\exchangeexports$\$date.pst"
Search-Mailbox -id "SVC-EXCH-JOURNLING" -DeleteContent -Force

 

or i could pipe it?

 

Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.Admin"
$date = Get-Date -format "dd/MM/yyyy"
New-MailboxExportRequest -Mailbox SVC-EXCH-JOURNLING -FilePath "\\fp-itstorage\exchangeexports$\$date.pst" | Search-Mailbox -id "SVC-EXCH-JOURNLING" -DeleteContent -Force

 

Thanks

Edited by FN-GM
  • 2 weeks later...
Posted
quick look it won't work. You would probably be better using Get-MailboxExportRequestStatistics to see if the export is complete then do the delete.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...