David-Barrett-MS / PowerShell-EWS-Scripts

A collection of PowerShell scripts that use EWS to perform actions against Exchange mailboxes
MIT License
118 stars 13 forks source link

How to do a 1:1 source mailbox to target mailbox copy with merge? #58

Open riahc3 opened 2 months ago

riahc3 commented 2 months ago

Hello

We had a weird issue where a mailbox was deleted in O365. Im restoring it to user2@domain.com

Now I want to copy all that from user2@domain.com to user@domain.com merging everything and such.

There arent pretty clear examples on how to do this; Specially the merge part.

It seems to be

Merge-MailboxFolder.ps1 -SourceMailbox user2@domain.com -TargetMailbox user@domain.com

But I dont want to screw anything up.

Thanks

riahc3 commented 2 months ago

./Merge-MailboxFolder.ps1 -SourceMailbox user3@domain.com -TargetMailbox user@domain.com -Copy -ProcessSubFolders -CreateTargetFolder -IgnoreSSLCertificate -AllowInsecureRedirection -Office365

For example, this attempts to open a web browsesr to ask for O365 admin credentials but it gives a 404 failing and not showing

riahc3 commented 2 months ago

I think this is the only proper way to do it as I logon to the user3 and I see other folders that are NOT copied when using a pst export

riahc3 commented 2 months ago

Can anyone help? Microsoft is saying with their procedure there will be data loss so it seems (again) this is the best unofficial way to do it....

David-Barrett-MS commented 2 months ago

Yes, this script can do a full mailbox copy/move, and your parameters look fine.

riahc3 commented 1 month ago

Yes, this script can do a full mailbox copy/move, and your parameters look fine.

  • Your authenticating account needs access to both the source mailbox and the target.
  • If impersonating, the impersonated account needs FullAccess permissions to the target mailbox.

First, thank you for replying. We have a bit of a desperate situation and I think your script can solve it.

The issue is that when passing the -Office365 parameter, a web browser opens, but it gives a 404. I e tried it several days and nothing.

While on the subject, can it copy a deleted mailbox to a active one? That would be just perfect but might be a MS limitation. Just asking to know.

My biggest issue is getting the o365 auth to work to copy the mailbox to another one

riahc3 commented 1 month ago

No answer still :/ Is any more information needed?

David-Barrett-MS commented 4 weeks ago

If you see a web browser open when running the script, then you are using delegated auth. Where does the 404 come from? If it's due to the redirect (i.e. after log-in), then you'll need to check your redirect URL. If it's prior to logging in, then you'll need to check why you are unable to reach Microsoft log-in services (that wouldn't be anything script related).

Alternative is to use app auth (which doesn't require user interaction).