Update to Wipe Exchange Online Mailbox script

Update to Wipe Exchange Online Mailbox script

Rate this post

Earlier today, I was asked to make an update to my script to wipe Exchange Online mailboxes to include Archive Mailboxes.  Fortunately, it ended up being much easier than I anticipated:

When I enumerated the mailbox originally, I used:

$Root = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Root)

In order to access the Archive folder, I just had to change the WellKnownFolderName from Root to ArchiveRoot, after examining the list available at https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.wellknownfoldername(v=exchg.80).aspx.

$Root = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::ArchiveRoot)

But, not being able to leave well enough alone, I wanted to provide some additional options, such as wiping only the mailbox, only the archive, or both, or being able to specify more than one user on the command line.  You can pick up the new and improved version at the TechNet Gallery: https://gallery.technet.microsoft.com/Wipe-Exchange-Online-331ab4f4

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.