Thursday, August 24, 2006

 

How to remove PSTs from Outlook Profile with a script

I have a few customers implementing DisablePST via a custom .adm template that my coworker Jeremy Waldrop put together.

Oddly enough, setting DisablePST to 1, on its own, does not disable the ability to open an existing .pst file. To block that feature, you can disable the File Open Outlook Data File command with a Group Policy Object using the setting "Disable command bar buttons and menu item." That command's =ID is 5576.

These 2 settings prevent use of adding new PST files to Outlook.

BUT WHAT ABOUT PSTs THAT ARE ALREADY ATTACHED TO PROFILES?

Nope, any PSTs that were already attached still work?

Well, anyway, the customer didn't want those existing PSTs to be available in the outlook profile anymore. And if you just go and delete the PSTs from the storage location, you cause a bunch of errors in Outlook.

So we had a few options, either request users to disconnect their PSTs gracefully (yeah right), run outlook with a .prf file just to create a brand new profile without PSTs (they didn't like this), use a 3rd party like DesktopStandard(expensive), or write a little script to hack the registry.

Well, to make a long story short, we wrote a little script to hack the registry.

run this with cscript.exe from a batch file or whatever. This has not been fully regression tested, yadda... yadda.

In fact, this is probably pretty dirty coding, I just sort of pieced it together best I could. Good luck, MAKE SURE OUTLOOK.EXE IS NOT RUNNING WHEN YOU RUN THIS.

THIS WILL GO THROUGH EVERY OUTLOOK PROFILE IN YOUR HKCU REGISTRY AND WIPE OUT ALL REG KEYS THAT ARE RELATED TO PST FILES. THIS DOES NOT DELETE PST FILES, JUST THE POINTERS TO PST FILES. BE CAREFUL ANYWAY AND GOOD LUCK.

Script can be found here: http://www.ccs5000.com/scripts/cleanpstkeys.txt

Let me know if this was useful. jcook@cookconsultingservices.com

This page is powered by Blogger. Isn't yours?