Remotely remove code from "ThisOutlookSession" (VbaProject.otm)

Posted on 2009-02-13
Last Modified: 2012-05-06
We have some custom code added to "ThisOutlookSession" for all computers.  The vba project is also signed with a digital certificate created with selfcert.exe.  We no longer need the functionality that the code was providing and need to remove the code from all computers.  What is the best / cleanest way to do this remotely?  From my understanding the VbaProject.otm is the file getting saved when the code was added to "ThisOutlookSession".  In testing this, simply deleting, renaming or moving the VbaProject.otm from %userprofile%\application data\microsoft\outlook does the trick.  The file cannot be deleted, renamed or removed while Outlook is running.  Or, manually removing the actual code from the vba project and saving the blank file also works.  There are multiple profiles on many of the computers and we need to removed the code / file from All profiles.

1.  Is this a safe way to go about getting rid of this code?
2.  Do we have to do anything with the digital certificate created with selfcert.exe that was being used to sign the vba project or can it just hang around?
3.  Is there a way to remotely remove the file and / or code via Group Policy (start up scripts, etc.)?
Question by:parinpatel
    LVL 76

    Accepted Solution

    Hi, parinpatel.

    There is no good way to do this.  Microsoft apparently never envisioned sharing Outlook macro code and thus provided no means for managing it.  Outlook stores ALL its code in the file VbaProject.OTM, not just code in ThisOutlookSession.  

    1.  That depends on what you mean by safe.  There is NO means of removing the code.  You cannot manipulate code in Outlook from code (i.e. there's no means of scripting the addition, change, or removal of code that's in Outlook).

    2.  The cert will be fine, but you're almost certainly going to be forced to sign the code again.

    3.  The only automated means of removing the code is to replace the .OTM file.  You can do that from a login scipt by simply overwriting the file with a replacement file.  Keep in mind though that if any of your staff have any other code in Outlook, then overwriting the file is going to erase it.  
    LVL 1

    Author Closing Comment

    Thanks much BlueDevilFan.
    LVL 76

    Expert Comment

    by:David Lee
    You're welcome.  Glad I could help.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
    Learn more about the importance of email disclaimers with our top 10 email disclaimer DOs and DON’Ts.
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now