none
VSTO Group Policy Install for Outlook 2010 - HKLM to HKCU programmatically? RRS feed

  • Question

  • Hi VSTO gurus,

    I have a VSTO project for Outlook 2010 which I ultimately want deployed via Group Policy.

    From what I've read you can't do this with ClickOnce so I've built an msi and bootstrapper for all the VSTO prerequisites and it's working great for anyone with admin rights on their local machine.

    Next step is applying this to Group Policy installs. I understand Office 2010 (and Office 2007 with a hFix) allow VSTO addins loaded from the local machine hive rather than the current user, effectively meaning anyone who logs into the local machine and starts an Outlook session has my addin loaded by default.

    Could someone clarify a couple of issues about the implications of this.

    Could I change the registry load behviour so that the addin is disabled ( value 2 rather than 3) by default and each user has to go into the Com addins panel in Outlook and explicitly load it for themselves? Can they change the registry value in HKLM if they don't have admin rights? If they can I guess that would then enable the addin for everyone.

    Assuming this isn't a possibility (I am guessing it isn't), once my addin is loaded from HKLM could I then write a registry value from inside my addin to the HKCU, loading my addin from there the next time it starts? What order does the Office loader (Fusion?) check the registry in which entry would it hit first? Would it just load the addin twice?

    Basically is there any way to personalise the addin on a current user basis when it is installed via Group Policy?

    Many thanks in advance for any responses.

    Monday, December 12, 2011 10:46 AM

Answers

All replies

  • Hi,

    Generally, you understand the VSTO deployment right.

    The two delployment ways, ClickOnce deploys per user and Windows Installer deploys per user, or for All User.

    Set load on demand(LoadBehavior=2). I'm afraid you could not change HKLM registry value with normal user privilege. Admin rights is required in this case.

    By setting VSTO registry keys under HKLM, you have installed it for all user. In other words, we don't replicate the registry keys to HKCU in this Office2010. While if you install the solution via ClickOnce, it will set the registry keys under HKCU.

    Now that you want to change load behavior on current user basis, I think it's viable. With ClickOnce deployment, the registry keys are under HKCU, we can modify the registry via reg add command.

    Conclusion:

    It's viable to deploy via Group Policy. The idea is that:

    1.  Write a batch script, which does these:

    a)    Copy the published VSTO solution to local, e.g %temp%

    b)    Silent Install vsto solution via %commonprogramfiles%\microsoft shared\VSTO\10.0\VSTOInstaller.exe /install url /silent.

    c)    Set LoadBehavior=2 and export the registry to a file.

    d)    reg add exported reg file

    2.  Setup Global Policy.

    a)    On domain controller, create a new Global Policy Object;

    b)    Edit the Global Policy Object;

    c)    Add the batch script as Logon script. See picture below.


    Forrest Guo | MSDN Community Support | Feedback to us

    Thursday, December 15, 2011 4:58 AM
    Moderator
  • Hi Forrest,

    many thanks for your reply, much appreciated.

    Could I trouble you with a couple of futher questions related to the hotfix for 2007 that I mentioned above which allows VSTO loading for all users from the HKLM?

    KB976811 available through KB976477.

    1.

    Is this included in SP3 for Office 2007? I can't seem to find this info on MSDN anywhere.

    2.

    I have a test machine with Office 2007 and I've installed my addin (the same installer loads my addin no problems from the HKLM on Outlook 2010) under the HKLM with all the values set correctly. Installed updates confirms that Hotfix for Office (KB976477) is installed. But my addin isn't loading (load behaviour is still 3 so it's not an error, the loader simply isn't looking for it). There is no registry entry for EnableLocalMachineVSTO under
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\. Do we have to install this entry by hand on every Office 2007 machine? This blog seems to suggest so - 

    http://blogs.msdn.com/b/vsto/archive/2010/03/08/deploying-your-vsto-add-ins-to-all-users-saurabh-bhatia.aspx

    Thanks once again for the help

    Friday, December 16, 2011 10:02 AM
  • Hi, you're always welcome to ask questions on forum, and I'm glad to help on your question.

    1. KB976477 is included in Office 2007 SP3. Generally, Office service pack is big release, while KBXXX is hotfix. These hotfixes are republished in service pack.  I have setup Office 2007 test lab to verify it. Office 2007 SP3 contains the fix.  The description of SP3 stated the process in introduction section: http://support.microsoft.com/kb/2526086
    2. Generally, Addins developed for higher version of Office doesn't run on lower version of Office. If you want to get it run on both Office 2007 & Office 2010, you will need to develop against Office 2007. We don't need to apply the registry entry manually. On my lab afte rapplied Office SP3, there's no EnableLocalMachineVSTO. I didn't give it a try to install KB976811 standalone.

    Reference:

    Please let me know if there's something unclear.

    Best Regards,


    Forrest Guo | MSDN Community Support | Feedback to us


    Sunday, December 18, 2011 5:35 AM
    Moderator