Link to home
Start Free TrialLog in
Avatar of jcritzer
jcritzerFlag for United States of America

asked on

Delete Exchange 2007 folder across all mailboxes

So I'm under the impression this is impossible but let's give it a whirl...

We just setup an email archiving system called Proofpoint.  Part of this setup included running an OutlookFolderTool.exe file which Proofpoint provided us that created a subfolder under every user mailbox called "Archive by Proofpoint" which links to the website running on the appliance.

The problem lies in the fact that the home page for the newly created folder was setup to point to an HTTPS website when it needs to be pointing to an HTTP site, so nobody can currently get into the appliance to look at their archived emails.

Now, I'm no expert at either Powershell or VBS but nothing I have been able to come up with can either edit the properties of, or just plain delete, a subfolder under every mailbox across the organization.

I don't want to send out an organizational email to 800 users asking them to delete a subfolder because, under Murphy's Law and no matter how specific I am, people will invariably delete the wrong thing and I'll be doing restores for the rest of the month.

Any help GREATLY appreciated...
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Okay so it should be possible, but you have to be so very very careful with this (as I'm sure you're quite aware).

In theory... we can use Export-Mailbox to target a specific folder and do away with it. It would go something like this from the Management Shell:

Export-Mailbox "SomeMailbox" -IncludeFolder "/Archive by Proofpoint"  -DeleteContent

Extending that to all users goes:

Get-Mailbox | ForEach-Object {
  Export-Mailbox "SomeMailbox" -IncludeFolder "/Archive by Proofpoint"  -DeleteContent
}

Please test this very carefully first on mailboxes that do have the folder and mailboxes that don't. I imagine you could fabricate some of those easily enough :)

I reserve the right to have the syntax for Export-Mailbox wrong, I haven't got the Exchange tools here to test with. Check out Get-Help Export-Mailbox (-Full) for the options available.

Finally, if you can, export the folder to something else (another mailbox), that way if someone has been using it to store things you're safe because you can trivially get it back.

Chris
Avatar of jcritzer

ASKER

Running the following completes successfully in PS but does not actually delete the folder:

Export-Mailbox "user" -IncludeFolder "\Archive by Proofpoint" -DeleteContent
I may have the path to the folder wrong, you might try without the \, or switch it for /.

And if you could, pop something into the folder so we can see if it's finding the folder and deleting items, then simply failing to delete the folder itself.

Cheers,

Chris

Hmm although DeleteContent has a note that might render it quite useless: "The source folder isn't deleted". Still, let me know how you get on with the testing because at the moment I don't have a better alternative.

Chris
Running with / does not work.

And yes, it's clearing out the contents of the folder, not the folder itself.
Yep, this is the issue I've been running into for 48 hours now :)

It's annoying, I reckon it can be done with either MAPI or WebDAV but they're pretty irritating interfaces to work with for a non-programmer (like me).

All for need of Remove-MailboxFolder / Item.

Chris
I'm not a real programmer by any stretch of the imaginiation - usually editing scripts is the extent of it for me.

I know you can delete Outlook folder via the local profile with MFCMAPI.  Is there a way to script out the MAPI commands via VBS?  Maybe?
Hmm I'd be interested in testing the last method Shay decribes here:

http://www.vistax64.com/powershell/156862-deleting-folder-user-mailbox-exchange-2007-a.html

Depends how you feel about third-party tools really. I reckon we're a bit out of luck with native support or remotely easily accessible interfaces.

Do you ever feel the internal mailbox management has been slightly neglected in Exchange over the years? :)

Chris
> Is there a way to script out the MAPI commands via VBS?  Maybe?

I'd be really surprised if that wasn't possible. Alas my experience with the MAPI interface is limited to getting mailbox sizes from Exchange 2000, horribly out of date.

Chris
I stumbled across that post yesterday.  After trying to install RDO and feeling as if I was reinventing the wheel, I promptly gave up.

I use MAPI on occassion but I'm not familiar with its scriptability by any manner of speaking.  Maybe I should've included that forum with this post...

I'm still waiting on MS to release the most intuitive UI ever created for Exchange cmdlets..  After asking a few questions to generate the desired command, it says "You want to export these 13 mailboxes to storage group "HHGTTG," including only folders labeled 'Don't Panic!' and omitting all messages not 42k in size?  Sure!  No problem!"
Oh, cool, thanks.  Let's see if we have officially stumped the elite :)
ASKER CERTIFIED SOLUTION
Avatar of jcritzer
jcritzer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Damn, far too easy :) A nice find :)

You might check that on a system were multiple profiles are configured and outlook is prompting for a profile. Or are you free from those?

Execution... yeah logon scripts are no fun for this. Remote execution is not going to be too good, you'd need passwords for everyone.

It's annying really because you can access the mailbox centrally with CDO, but for knowing the deletion method.

Chris