r/PowerShell • • Jul 18 '19

Restore-RecoverableItems saved me

Got a request to apply retention to a 365 shared mailbox so emails permanently delete after 30 days. Accidentally applied as default tag(worst mistake of my IT career thus far) instead of personal Tag in 365 causing it to purge 40 mailboxes. When I called microsoft I asked for all options and they told me the only option is to run MFCMAPI.exe on the local machines to recover purged items which is very time consuming and doesnt recover everything back to normal you have to import the .pst. After talking to microsoft again (lvl2 support) with still no other options I moved forward with what they suggested. After recovering a couple mailboxes I encountered a MAC user which I couldnt use MFCMAPI for. My co-worker mentioned trying the exchange powershell and recoverable-items cmdlet just as a long shot. After running "Restore-RecoverableItems -indentity [email protected] -FilterItemTyple IPM.Note -sourcefolder PurgedItems -ResultSize Unlimited"I was able to restore all employees mailboxes back to normal quickly, in the background and maintain some credibility out of the circumstance. Powershell saved me

124 Upvotes

35 comments sorted by

3

u/petecetera Jul 18 '19

Wow, that must have been an unpleasant day for you. Glad you got it sorted

10

u/slipnatius Jul 18 '19

6,000 employees. Thankfully we caught it fast. I thought I was going to need a lawyer for a second. Co-workers were legit worried for my life lol. All good now though.

2

u/petecetera Jul 19 '19

Same here, still get paranoid when I click that button to make global changes though . 😂

12

u/GeNeTiCShaDoW Jul 18 '19

How did microsoft support not know this? 🤔

33

u/Popcompeton Jul 18 '19

Have you spoken to MS support? lol

4

u/[deleted] Jul 18 '19

They don't even call back when they say they will.

5

u/[deleted] Jul 19 '19

They're call center employees, not necessarily technicians

1

u/Boolog Jul 19 '19

Because lv 1 and 2 of MS support work with procedures, and don't really know any POSH unless it's from personal knowledge.

1

u/GeNeTiCShaDoW Jul 19 '19

Thats just bad if you ask me..

2

u/Boolog Jul 19 '19

Never said it was good, just how it is. There's a reason I google first, ask Reddit afterwards and only talk to MS as a last resort

2

u/slipnatius Jul 19 '19

Yes, I knew better and typically call Microsoft last. But with the amount of impact I figured they could do something immediate. We even contacted our Microsoft rep for local support and they didnt have much to provide either. My faith in Microsoft is gone. Faith in Powershell and its followers at an all time high.

1

u/Boolog Jul 19 '19

Microsoft are very good at providing tools (POSH, sccm etc) but not very good at providing support for them

18

u/BreedScreamer Jul 18 '19

Great post!!! THat is a very handy command to know.
I'm glad it ended a little better than it started for you :-)

As an old Boss used to say when people cocked up, "I.T. Happens man, I.T Happens"
We've all had a colossal blunder at one stage in an IT career, it's part of the job, it's only a problem if you keep making the same mistakes :-)

In 30 years of IT experience, I leave you with this :
"A backup, is not a backup, until you've used it to successfully recover"

>-)

24

u/christech84 Jul 18 '19

Im putting this into my "Handy stuff.txt" notepad ++ mess of useful commands just in case. Thanks, and glad you were able to recover.

33

u/[deleted] Jul 18 '19

*Tosses into OneNote*

(Shut up, I like it.)

7

u/[deleted] Jul 18 '19

OneNote is fantastic

8

u/gtipwnz Jul 19 '19

I always say one note is the best application Microsoft has put out.

1

u/pallytank Jul 19 '19

Excel would like to have a Word.

13

u/Snickasaurus Jul 19 '19

Ditch Notepad++ for a solid week and use Visual Code Studio.

7

u/WILL_CODE_FOR_SALARY Jul 19 '19

That anything like Visual Studio Code?

9

u/Snickasaurus Jul 19 '19

It’s m0ar code, less studio.

3

u/christech84 Jul 19 '19

wow. this is note-taking on another level

2

u/Snickasaurus Jul 19 '19

It's for those *rips off sun glasses* that take serious notes

3

u/hex00110 Jul 19 '19

Recently made the transit and can’t go back

2

u/[deleted] Jul 19 '19

Yes, vscode rocks, I use the tree view, File->Open Folder. And save a bunch of different text docs in markdown for my procedures. If you keep long txt files, you might look into adding some markdown because vscode can outline that for you.

1

u/[deleted] Jul 19 '19

The hex viewer plugin is much worse in VSCode than in Notepad++.

Apart from that I like it very much.

7

u/SolidKnight Jul 18 '19

sfc /scannow

4

u/gtipwnz Jul 19 '19

Lol is that a joke for like, last ditch effort?

7

u/SolidKnight Jul 19 '19

A joke. Most common answer from MS T1 support.

1

u/JoeyMack47 Jul 19 '19

Filing this and @kyserTheHun's comment below,

"I used to use this on my annoying users while I'd go google their problem. Shows them that their problem is being worked on even if it rarely fixes issues."

under - "how to deal with stupid user tricks."

6

u/schlik20 Jul 19 '19

People, please backup office365! It’s crazy how many people think it’s not necessary.

3

u/willy_der_schwimmer Jul 18 '19

Hey thanks for the post this is a good one

2

u/oW_Darkbase Jul 19 '19

It's shocking that the customer support could not recommend this to you, not even level 2

2

u/JoeyMack47 Jul 19 '19

Way to go!