Pinning items to the taskbar and start menu via GPO in Windows 7

Pinning items to the start menu and task bar in Windows 7 can be complicated if you’re trying to do it via group policy object (GPO). That’s because pinned items are stored in he registry under HKCU. Simply copying the shortcut files via batch script to %ALLUSERPROFILE%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar won’t work. So, if you upgraded workstations from Office 2010 to Office 2013 but your standard system image had Microsoft Office 2010 icons pinned to the start menu and task bar for all users, you’ve got to be a bit more creative. Here’s how I got rid of the old shortcuts originally created via unattend.xml in %ALLUSERSPROFILE% from the start menu and task bar in Windows 7.

[the problem]

Removing existing broken pinned start menu and task bar shortcuts to Microsoft Office 2010 programs after deploying Office 2013 and pinning Office 2013 application shortcuts instead.

 

[the solution]

[step 1] Remove the broken shortcuts from the default user account and add new shortcuts via batch script.

@echo off
REM delete Office 2010 shortcuts from C:\Users\default user and C:\Users\default
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Excel.lnk"
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Word.lnk"
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Outlook.lnk"
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Excel.lnk"
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Word.lnk"
del "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Outlook.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Excel.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Word.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Outlook.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Excel.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Word.lnk"
del "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Outlook.lnk"

[step 2] On a machine with Office 2013 installed create/copy shortcuts for the desired 2013 Office applications to a centrally accessible repository. I used my administrative Office 2013 installation and simply created a sub folder named Shortcuts and then placed my shortcuts there.

[step 3] Copy the new Office 2013 application shortcuts to the Default User and Default accounts.

REM copy new office shortcuts to C:\Users\default user and C:\Users\default
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Outlook 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Word 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Excel 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\PowerPoint 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Outlook 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Word 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Excel 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\PowerPoint 2013.lnk" "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Outlook 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Word 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Excel 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\PowerPoint 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Outlook 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Word 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\Excel 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
copy "\\SERVER\SHARE\MSOFFICE.13\Shortcuts\startmenu\PowerPoint 2013.lnk" "C:\Users\default user\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"

[step 4] Copy the following VBS script (credit – multiple sources unknown author) to the local workstation or execute it from a network share. I have an Existing GPO which creates a utility folder on the C:\ drive of all workstations. I simply copied the VBS script there.

download VBS script ExecVerbAction

REM copy VBS script to local C:\UTILS\SCRIPTS - NOTE: DIR MUST EXIST!
copy "\\SERVER\SHARE\SCRIPTS\ExecVerbAction.vbs" "C:\UTILS\SCRIPTS"

[step 5] Call the script copied in [step 4] to Unpin the old startmenu and taskbar shortcuts. Then call it to pin the new shortcuts to the startmenu and taskbar for the local logged on user.

REM Unpin old icons
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Outlook.lnk" UnpinFromStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Word.lnk" UnpinFromStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Microsoft Excel.lnk" UnpinFromStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Outlook.lnk" UnpinFromTaskbar
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Word.lnk" UnpinFromTaskbar
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Excel.lnk" UnpinFromTaskbar
REM pin new icons
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Outlook 2013.lnk" PinToStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Word 2013.lnk" PinToStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Excel 2013.lnk" PinToStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\PowerPoint 2013.lnk" PinToStartMenu
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Outlook 2013.lnk" PinToTaskbar
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Word 2013.lnk" PinToTaskbar
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\Excel 2013.lnk" PinToTaskbar
cscript C:\UTILS\SCRIPTS\ExecVerbAction.vbs "C:\Users\default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\PowerPoint 2013.lnk" PinToTaskbar
exit

[step 5] download the full batch script and create a user based group policy object (GPO) to run at logon which executes this script.

download fix-office-shortcuts

[step 6] Test it out on a workstation.

That’s it.

Skip to content