17

During an installation or major upgrade, if a user has pinned the application to their task bar, then after the installation has completed, the task bar shortcut is removed from %AppData%\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar and a blank-file icon (see image link below) is left in its place.

Clicking the icon will prompt the user to delete as it doesn't target anything.

enter image description here
(Mirror: https://i.stack.imgur.com/kz1zW.png)

I would like to make it such that the taskbar shortcut is not removed at all when installing or running a major upgrade. We push out updates on a weekly basis and it can be frustrating if the taskbar shortcut breaks during every update.

Is this possible?
I've read about modifying the value for RemoveExistingProducts (i.e. changing from InstallValidate to InstallFinalize), but I'm unsure if this will be viable.

Nicke Manarin
  • 3,026
  • 4
  • 37
  • 79
user3216062
  • 173
  • 1
  • 6

3 Answers3

7

You can avoid custom actions by disabling the standard RemoveShortcuts as follows:

<InstallExecuteSequence>
  <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>

This disables removing shortcuts except on uninstall.

Mike Ward
  • 3,211
  • 1
  • 29
  • 42
  • Tested this on Windows 10, works like a charm! This should be the accepted answer. The only issue is that the taskbar shortcut won't remove itself when uninstalling but this is something I can live with. – Crono Mar 10 '16 at 15:12
  • @Crono have you found a way to remove it on uninstall? – norekhov Nov 05 '21 at 15:30
  • See [this answer](https://stackoverflow.com/a/17608049/5369075) if you want to tweak the condition. I think this will still remove the shortcut on a repair. – jcox Jun 02 '23 at 03:39
5

We encountered this issue and our investigation reveals that msiexec.exe explicitly removes pinned item when remove corresponding shortcut on uninstall or major upgrade.

As workaround we did the following:

  1. Disabled standard RemoveShortcuts action using the following WiX code:

    <InstallExecuteSequence>
      <RemoveShortcuts>0</RemoveShortcuts>
    </InstallExecuteSequence>
    
  2. Added explicit <DeleteFile> entry for every shortcut we install. For example:

    <DirectoryRef Id="ProgramMenuDir">
      <Component Id="Component" Guid="B7469BFC-BF2A-4AF7-9DF5-3458BB485F18">
        <Shortcut Id="Shortcut" Name="My Supper App"
                  Directory="ProgramMenuDir" Target='MyApp.exe' />
        <RemoveFile Id="RemoveShortcut"
                    Name="My Supper App.lnk"
                    On="uninstall" />
      </Component>
    </DirectoryRef>
    

It seems to be working fine.

Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88
Ivan Zhakov
  • 3,981
  • 28
  • 24
-2

I'm not sure what you can do to prevent it from happening, but this might help you at least replace it. This method uses a logon script, but you should be able to implement this with wix

Windows 7 taskbar pinned icons are stored in the following locations

File System: %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Registry: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband] To deploy it, you can perform the following steps:

  1. Configure Pinned items on a Windows 7 system as a reference computer.
  2. Export Reigstry Key to pinned.reg file: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband] And copy items in the "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" to a shared folder.

  3. Create a logon script to deploy the registry keys and copy the corresponding files. Please note that the “%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned” folder is only created after a user has pinned an icon to the taskbar. In the logon script, you will need to create the “%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar” folder if it does not exist.

Source: http://social.technet.microsoft.com/Forums/windowsserver/en-US/d172b4de-be7c-4149-8958-bebfe042ade1/forum-faq-how-to-deploy-windows-7-taskbar-pinned-icons-by-group-policy?forum=winserverGP

Justin Loveless
  • 524
  • 1
  • 10
  • 25