Simply Move All Your Archive Back to the Mailbox

4 בOctober 2016

2 תגובות
Hey Friends!

Recently I’ve encountered a situation…
– An administrator had enabled an in-place archive on a few mailboxes
– He wasn’t aware of what archiving would do to his users’ mailboxes – End of story 🙁

The procedure of getting all the items back to the main mailbox is a bit complicated, mostly because the procedure must involve explicit connection to the user’s mailbox, exporting the archive mailbox to PST and re-importing it back to the main mailbox.

There are tools out there that may help perform the above actions if you are willing to pay 🙂

This is why I wrote a cool script that will move all the archived items back to the mailbox.

Here are some screenshots and guidelines:

  • First of all, this script make use of the EWS Managed API version 2.2download
  • Now download my script – download
  • You must create a new Retention Policy without any Archive Tags and assign it to the specified user’s mailbox
  • The administrator user that manages the user’s mailbox, should be an Organization Management user and assigned the ApplicationImpersonation role, although you will be presented with a prompt to assign the role (and remove the assignment) during the script run.

Starting the script is easy… Just run it without any parameters


Enter the admin username (of type User Principal Name), the password of this admin and the user’s mailbox (also UPN). That’s it!

As stated before, you may need to assign the ApplicationImpersonation role to the admin user


Now sit back and watch how the items move back to the main mailbox 🙂


At the end you will find a log like this in the same folder of the script.

UPDATE 10/10/2017:

  • Fixed the issue with Folders which are in a foreign languages or has special characters in them – the script was modified to ignore the folder name and concentrate solely on the folder Id parameter.
  • Added feature: The script will move folders which are not mirrored in the main mailbox – This folder will move to the “\Archive” folder in the main mailbox (if this folder doesn’t exist, the script will create it)
  • Added support for Exchange On-Premise: Only works with Kerberos authentication

Have a great time using this script!

הוסף תגובה
facebook linkedin twitter email

Leave a Reply

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

2 תגובות

  1. Andy8 בDecember 2016 ב 13:30


    1. Pavel Rozenberg10 בOctober 2017 ב 14:23

      I’ve made more updates to the script and fixed what you have pointed out.