Asked by:
Forum FAQ: How to deploy Windows 7 Taskbar Pinned Icons by Group Policy?

General discussion
-
Question
How to deploy Windows 7 Taskbar Pinned Icons by Group Policy
Answer
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.
More Information
If you want to pin items to the Start Menu, you may refer to the following script:
Pin Items to the Start Menu or Windows 7 Taskbar via Script
Applies to
Windows 7
Monday, February 22, 2010 7:12 AM
All replies
-
Hi there,
Thanks for that Q&A - very useful. I wonder if you can help with a related question?
We've got an environment where we would like a particular item to be pinned to the taskbar on a particular PC regardless of which user logs on to that computer. Is this doable? Additionally the item shouldn't show on the taskbar when that user logs on to any other computer.
I'm guessing loopback processing might help here but what I'd like to know is if I need to replace the entire set of pinned items or can I selectively add / remove a specific item?
Thanks in advance!
Tuesday, October 19, 2010 6:15 PM -
Hello,
Does this procedure work for deploying items pinned to the Start Menu?
I can see that alternate path to use for Start Menu items:
File System:
%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenuBut are these also stored in the registry item taskband or is there another key that holds StartMenu settings?
Thanks for this Lex
Thursday, October 28, 2010 12:40 AM -
Yes, Excellent and useful....but maybe instead of taking a swipe at those who use logon scripts you could explain HOW to do it in "Group Policy Preferences" for those of us who don't know.
my 2 cents
Tuesday, March 15, 2011 7:31 PM -
This method works great!
I've found that it can be incorporated into the Default profile in the following post:
Thursday, March 17, 2011 9:10 PM -
Hello,
this does not work for me (Windows 7 SP1 32bit, German). When i import the reg-File manually, nothing happens, no Quick-Launch-Bar is available. The above mentioned files and directories exist on the PC. Is anybody able to reproduce this behavior?
Kind regards.
Monday, September 5, 2011 11:08 AM -
I do realize that question posted here is about how to use Group Policy to accomplish Taskbar customization, but would like to offer what I believe is a better method for performing the changes. Whether Group Policy, SCCM, baking it in to an image, etc. the choice is yours.
The following was put together based on ideas from other techs/coders and assumes that you are using an english version of Win7, as it uses Verbs (the items you see when you right click a file) to "Pin to Taskbar". Other languages will need to replace the text accordingly.
These two scripts and batch file that I put together for my agency are currently being used, and are implemented via SCCM. It is applied on first logon for any user to any PC.
We wanted to programmatically configure the icons on the Taskbar as follows -
Remove:
Windows Media PlayerAdd:
OutlookChange:
Windows Explorer (Libraries) to Windows Explorer (Computer)Create the three files and put them in the same folder...
***************************************
Name this script (Pin.vbs)
***************************************Set objShell = CreateObject("Shell.Application")
Set filesystem = CreateObject("scripting.Filesystemobject")
If filesystem.FileExists(Wscript.Arguments(0)) Then
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
Set colVerbs = objFolderItem.Verbs
Select case WScript.Arguments(1)
case 0
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next
case 1
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
case 2
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Install" Then objVerb.DoIt
Next
End Select
End If***************************************
The following script can be used to programmatically create Shortcuts. I could have used a preconfigured .lnk file and just xcopy'd it, but this is just cooler :)
You'll notice there are commented (') out sections for Shortcut Name. You can use one of the three depending on the way you'd like to reference the destination folder for the icon being created.
***************************************
Name this script (MyExplorerLnk.vbs)
***************************************Set WshShell = WScript.CreateObject("WScript.Shell" )
' Shortcut Name (Special Folders)
' strLocation = WshShell.SpecialFolders("AllUsersDesktop" )
' Set oShellLink = WshShell.CreateShortcut(strLocation & "\Windows Explorer.lnk" )' Shortcut Name (Environment Variables)
strLocation = WshShell.ExpandEnvironmentStrings("%APPDATA%" )
set oShellLink = WshShell.CreateShortcut(strLocation & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Explorer.lnk" )' Shortcut Name (Normal Path)
' Set oShellLink = WshShell.CreateShortcut("C:\Windows Explorer.lnk" )' Path to application
oShellLink.TargetPath = "%Windir%\explorer.exe"' Command line arguments
oShellLink.Arguments = " shell:MyComputerFolder"' Window Style
oShellLink.WindowStyle = 1' Hotkey
oShellLink.Hotkey = ""' Icon for Shortcut
oShellLink.IconLocation = "%windir%\explorer.exe"' Shortcut Comment
oShellLink.Description = "Windows Explorer"' Working Directory
oShellLink.WorkingDirectory = ""oShellLink.Save
***************************************
The following Batch file is used to launch the above scripts, and also documents the use of Pin.vbs
Our agency primarily uses Win XP, Win 7 x86, and Win 7 x64... hence the limited version check.
***************************************
Name this Batch file (TBcustom.cmd)
***************************************:: Set Environment
@ECHO OFF
CLS
TITLE Taskbar Customization Tool
COLOR 3f
PROMPT $sSET UsrPinTBar="%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
:: *** Usage - Pin.vbs
:: *** WScript.exe "%~dp0\%~dp0\Pin.vbs" [drive:][path]filename [Argument]
:: *** [Arguments] = 0 1 2
:: *** 0 = Unpin from Taskbar
:: *** 1 = Pin to Taskbar
:: *** 2 = Install:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:: Identify Windows Version
:: *** Assign ver output to variable VerResult ***
FOR /F "delims=" %%A IN ('ver') Do Set VerResult=%%A:: *** Parse VerResult and assign variable according to OS version ***
ECHO "%VerResult%" | find "Version 6.1" > nul && GOTO Windows7Var
ECHO "%VerResult%" | find "Version 6.0" > nul && GOTO WindowsVistaVar
ECHO "%VerResult%" | find "Version 5" > nul && GOTO :WindowsXPVar
ECHO Error - Unexpected Version Information
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:Windows7Var
IF %processor_architecture%==x86 GOTO 7x86Var
IF %processor_architecture%==AMD64 GOTO 7x64Var
IF %processor_architecture%==IA64 GOTO 7x64Var
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:WindowsVistaVar
ECHO This PC is running Windows Vista
:: *** Unsupported ***
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:WindowsXPVar
ECHO This PC is running Windows XP
:: *** Unsupported ***
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:7x86Var
ECHO This PC is running Windows 7 32Bit:: *** REMOVE WINDOWS EXPLORER ***
WScript.exe "%~dp0\Pin.vbs" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Explorer.lnk" 0
IF EXIST "%UsrPinTBar%\Windows Explorer.lnk" DEL /q /f "%UsrPinTBar%\Windows Explorer.lnk":: *** REMOVE WINDOWS MEDIA PLAYER ***
WScript.exe "%~dp0\Pin.vbs" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk" 0
IF EXIST "%UsrPinTBar%\Windows Media Player.lnk" DEL /q /f "%UsrPinTBar%\Windows Media Player.lnk":: *** ADD CUSTOM WINDOWS EXPLORER (opens to shell:MyComputerFolder) ***
WScript.exe "%~dp0\Pin.vbs" %windir%\explorer.exe 1
WScript.exe "%~dp0\MyExplorerLnk.vbs":: *** ADD OUTLOOK***
WScript.exe "%~dp0\Pin.vbs" "%ProgramFiles%\Microsoft Office\Office14\Outlook.exe" 1
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:7x64Var
ECHO This PC is running Windows 7 64Bit:: *** REMOVE WINDOWS EXPLORER ***
WScript.exe "%~dp0\Pin.vbs" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Explorer.lnk" 0
IF EXIST "%UsrPinTBar%\Windows Explorer.lnk" DEL /q /f "%UsrPinTBar%\Windows Explorer.lnk":: *** REMOVE WINDOWS MEDIA PLAYER ***
WScript.exe "%~dp0\Pin.vbs" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Media Player.lnk" 0
IF EXIST "%UsrPinTBar%\Windows Media Player.lnk" DEL /q /f "%UsrPinTBar%\Windows Media Player.lnk":: *** ADD CUSTOM WINDOWS EXPLORER (opens to shell:MyComputerFolder)***
WScript.exe "%~dp0\Pin.vbs" %windir%\explorer.exe 1
WScript.exe "%~dp0\MyExplorerLnk.vbs":: *** ADD OUTLOOK***
WScript.exe "%~dp0\Pin.vbs" "%ProgramFiles% (x86)\Microsoft Office\Office14\Outlook.exe" 1
GOTO EOF:: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:EOF
EXIT***************************************
This method is what worked best for our particular needs, as our agency deploys virgin OS images and customizes and deploys software as SCCM task sequences and packages. It also does not dictate that a user can't customize the Taskbar as they see fit, and won't remove their own customizations, as would other methods posted that replace the Taskband registry values.
I hope this helps, and feel free to criticize or ask for assistance with it!
- RonSumMonday, September 5, 2011 5:06 PM -
First of all, I would like to express my appreciation for the scripts above. It realy helped me.
I wanted to create a screen lock button on the tasklist with a key as icon.
Though, I made a discovery that I think is important to tell in this thread. There is no need to copy anything to %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
The shortcut is created automaticly when anything is pinned to the tasklist, expecially using the pin.vbs Though, in my case, I had to change the verb strings to Swedish.I modify the MyExplorerLnk.vbs above to create my own screen lock-shortcut in %TEMP%, I used pin.vbs above, like "pin.vbs %TEMP%\MyShortCut.lnk 1" and the correct shortcut is automaticly created in %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar and visible in the taskbar as well.
In order to remove the pinned item, I run "Pin.vbs %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaksBar\MyShortCut.lnk 0" and the pinned item is gone, both in the folder and in the tasklist.
Though, still I have one thing to fix. I tried this a GPO-logon script and get a new button each time. After ten logon, I have ten buttons. But that is another story.
/Göran Sedvall
- Edited by Göran Sedvall Thursday, September 22, 2011 2:42 PM many misspelling
Thursday, September 22, 2011 2:34 PM -
How do you run this on first logon for the users??Sunday, October 9, 2011 7:02 PM
-
I will assume that you don't have any centralized management solution like SCCM (which I stated we used to implement this.)
An easy way to achieve RunOnce for standard users would be to adapt the procedure from my post as follows:
1. Place the two .vbs files from my above post in the "C:\Users\Default\AppData\Roaming\Taskbar Scripts\" folder.
You will have to create this folder ;)
2. Place the TBcustom.cmd file in the "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" folder.
If the Startup folder is not there, then it is either hidden or missing - I'm not sure because I just created it without checking first.
3. Change the references in the TBcustom.cmd file that point to the scripts -
From: WScript.exe "%~dp0\Pin.vbs"
To: WScript.exe "%APPDATA%\Taskbar Scripts\Pin.vbs"
4. Change the last line of TBcustom.cmd -
From: EXIT
To: DEL /Q /F %0
This deletes the TBcustom.cmd from the Startup folder of the user who just logged in for the first time.
I still don't get why RunOnce for Standard users was nerfed, and yet this is possible... but there's a lot I don't understand - lol
Cheers!
- RonSumMonday, October 10, 2011 7:07 PM -
We do have SCCM....
I'm just confused as to how to assemble and deploy it from there?!
Friday, October 21, 2011 9:10 AM -
Thanks for That Script!
But i guess i to a mistake. I want to publish it over GPO --> Logon Script.
The MyExplorer work fine to point on a network drive /e,V:\ instead of shell:MyFolder
But the outlook.ink isn't applying and the WMP isn't removing. I just copy paste everything like above.
Do you have any advice for me? Maybe its a languagge Problem (Client Computers working in German).Thanks a lot!
Thursday, November 3, 2011 4:02 PM -
Take a look at the Pin.vbs and adjust the following bold items according to what you see when you right click on an object that you want to Pin/Unpin/Install.
***************************************
Name this script (Pin.vbs)
***************************************Set objShell = CreateObject("Shell.Application")
Set filesystem = CreateObject("scripting.Filesystemobject")
If filesystem.FileExists(Wscript.Arguments(0)) Then
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
Set colVerbs = objFolderItem.Verbs
Select case WScript.Arguments(1)
case 0
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next
case 1
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
case 2
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Install" Then objVerb.DoIt
Next
End Select
End If***************************************
Replace with the german counterparts and all should be well.
- RonSum- Edited by IT wHo'e Thursday, November 3, 2011 5:32 PM
Thursday, November 3, 2011 5:27 PM -
WOW Thanks a lot! It worked fine
(For Others, in German its:
Von Taskleiste lösen
An Taskleiste anheften
Installieren)Edit: But its funny, now my Explorer isn't show anymore with arguments to /e. v:\
Strange... i only changed the 3 options you adviced...- Edited by Limpleg Friday, November 4, 2011 10:24 AM
Friday, November 4, 2011 7:22 AM -
Are you still using the TBcustom.cmd command file? The sections
*** REMOVE WINDOWS EXPLORER ***
and
*** ADD CUSTOM WINDOWS EXPLORER (opens to shell:MyComputerFolder) ***
should alter the existing pinned Explorer shortcut. You will want to change the -
' Command line arguments
oShellLink.Arguments = " shell:MyComputerFolder"to
oShellLink.Arguments = " /e,V:\"
in the Pin.vbs script.
If not I can't say what is happening for sure, but the logic is pretty simple and I'm sure you will figure it out.
- RonSumFriday, November 4, 2011 12:33 PM -
Yes i still use those scripts...
And i allready changed in the MyExploerLnk.vbsbefore i changed the pin.vbs to german it worked... strange...
I will still check... thank youFriday, November 4, 2011 1:04 PM -
Hey
I found out that my Shortcut ist written like "Windows-Explorer.lnk" and not like "Windows Explorer.lnk"
Maybe its because of different Languagges...But now it works!
Regards
Monday, November 21, 2011 12:45 PM -
RonSum,
Thank you so much for the script, it has been very helpful! Pardon my ignorance with coding but could you help me add a url shortcut to the deployed icon list as well? Windows 7 doesn't allow pinning of shortcuts or urls so they have to be pinned to the Internet Explorer icon. Thoughts?
Thanks :)
Friday, December 16, 2011 6:05 PM -
As this seems to be going a little off topic, I'll direct you to this:
http://msdn.microsoft.com/en-us/library/gg618532(v=vs.85).aspx
It requires IE 9.
- RonSumThursday, December 22, 2011 3:17 AM -
For information is the swedish verbs are as followed:
"Unpin from Taskbar"=Ta bort från Aktivitetsfältet
"Pin to Taskbar"=Fäst i Aktivitetsfältet
"Install"=Installera
Wednesday, December 28, 2011 2:58 PM -
I followed your directions for running this as a logon script but I keep getting errors such as the or saying it can't find the Pin.vbs file or it displays a VBS error dialog box.
I have made certain that I followed your directions for storing the files correctly.
Any Suggestions?
Sunday, October 28, 2012 8:02 AM -
Hello,
i am trying to find a solution for adding windows 8 taskbar-items be pinned and copied from a central location.
I have tried with this thread, but this isn`t working
1) Items are not copied to new location (gpresult says the GPO is applied):
Using Create AND update are not copying the files
2) When adding a shorcut to %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar the shortcut isn`t visible in the taskbar.
How to fix this for Windows 8?
Thx
Thursday, January 24, 2013 9:21 AM -
Can someone please tell me how to edir Gorans script so that explore can point to
%SystemRoot%\explorer.exe /E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
This way it opnes explorer to my computer and not libraries as well as doesnt spawn an additional process like his does.
Sunday, May 5, 2013 5:59 PM -
Hi RonSum,
I've found this thread through google and your script does exactly what we want in our company. I did save the files into 1 folder (network share) and when I run the TBcustom.cmd file manually the script works as it should.
However, we use Group Policy's in our domain and we would like to add the script as a user logon policy. I've added TBcustom.cmd to a GPO that has been applied to a test user. The script starts to run but I've encountered some problems. The standard Windows Explorer and Windows Media Player icons won't be deleted. The new Custom Windows Explorer icon won't be added. But the Outlook icon does.
As said before, if I run the script manually again it works. The Windows Explorer and Windows Media Player icons will be deleted and the new Custom Windows Explorer icon will be added. We are on Windows 7 x64.
I hope you or somebody else can help me.
Kind regards,Roy
- Edited by Roy.D Tuesday, July 9, 2013 8:23 AM layout
Tuesday, July 9, 2013 7:56 AM -
I tackled it a completely different way and made it deploy via a startup script in the user profile.
http://www.blackforce.co.uk/2014/01/23/how-to-pin-programs-to-windows-8-taskbar-using-group-policy-preferences-gpo
Works for me although a bit messy and less that ideal but gets the icons pinned.
Thursday, January 23, 2014 9:36 AM