none
Remove default pinned items from taskbar with gpo/p RRS feed

  • Question

  • I have created a custom windows 7 pro image through audit mode and then sysprepped it.  Upon new user login, I notice that the three default taskbar items (IE, WMP, Explorer) are still there.  How can I get rid of these with a gpo/p?

    And yes, the CopyProfile tag is set to true in my sysprep.xml file.

    Thank you.

    Monday, March 22, 2010 5:13 PM

Answers

  • This script works.

    'Credit goes to Eric G. for writing this script.
    'More info at http://frontslash.wordpress.com/2010/03/01/removing-internet-explorer-and-windows-media-player-from-taskbar/#comment-178
    
    Option Explicit
    
    Const CSIDL_COMMON_PROGRAMS = &H17
    Const CSIDL_PROGRAMS = &H2
    Const CSIDL_STARTMENU = &HB
    
    Dim objShell, objFSO
    Dim objCurrentUserStartFolder
    Dim strCurrentUserStartFolderPath
    Dim objAllUsersProgramsFolder
    Dim strAllUsersProgramsPath
    Dim objFolder
    Dim objFolderItem
    Dim colVerbs
    Dim objVerb
    
    Set objShell = CreateObject("Shell.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
    
    'Internet Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
        Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
        Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Media Player
    If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
        Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    
    Wednesday, March 24, 2010 5:44 PM

All replies

  • Hi,

     

    As far as I know, there is a Group Policy setting to change the Pin behavior.

     

    User Configuration\Administrative Templates\Start Menu and Taskbar\Remove pinned programs from the taskbar

     

    The pinned item information are saved 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]

     

    Hope this helps. Thanks.

     

    Dale

    Wednesday, March 24, 2010 2:12 AM
    Moderator
  • Hi,

     

    As far as I know, there is a Group Policy setting to change the Pin behavior.

     

    User Configuration\Administrative Templates\Start Menu and Taskbar\Remove pinned programs from the taskbar

     

    The pinned item information are saved 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]

     

    Hope this helps. Thanks.

     

    Dale

    No Dale, that does not help me.  If I enable that gpo, it will prevent users from pinning items to the taskbar, we need our users to have that ability.
     

    And if you delete the .lnk files from

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]

      it does not remove them from the taskbar, actually all it does is make it an unusable shortcut with no target. 

    And there is nothing in that registry key that is useful.

    Any other suggestions?

    • Edited by gjl_support Wednesday, March 24, 2010 4:17 PM typo
    Wednesday, March 24, 2010 3:34 PM
  • This script works.

    'Credit goes to Eric G. for writing this script.
    'More info at http://frontslash.wordpress.com/2010/03/01/removing-internet-explorer-and-windows-media-player-from-taskbar/#comment-178
    
    Option Explicit
    
    Const CSIDL_COMMON_PROGRAMS = &H17
    Const CSIDL_PROGRAMS = &H2
    Const CSIDL_STARTMENU = &HB
    
    Dim objShell, objFSO
    Dim objCurrentUserStartFolder
    Dim strCurrentUserStartFolderPath
    Dim objAllUsersProgramsFolder
    Dim strAllUsersProgramsPath
    Dim objFolder
    Dim objFolderItem
    Dim colVerbs
    Dim objVerb
    
    Set objShell = CreateObject("Shell.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
    
    'Internet Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
        Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
        Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Media Player
    If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
        Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    
    Wednesday, March 24, 2010 5:44 PM
  • This script works.

    'Credit goes to Eric G. for writing this script.
    
    'More info at http://frontslash.wordpress.com/2010/03/01/removing-internet-explorer-and-windows-media-player-from-taskbar/#comment-178
    
    
    
    Option Explicit
    
    
    
    Const CSIDL_COMMON_PROGRAMS = &H17
    
    Const CSIDL_PROGRAMS = &H2
    
    Const CSIDL_STARTMENU = &HB
    
    
    
    Dim objShell, objFSO
    
    Dim objCurrentUserStartFolder
    
    Dim strCurrentUserStartFolderPath
    
    Dim objAllUsersProgramsFolder
    
    Dim strAllUsersProgramsPath
    
    Dim objFolder
    
    Dim objFolderItem
    
    Dim colVerbs
    
    Dim objVerb
    
    
    
    Set objShell = CreateObject("Shell.Application")
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
    
    
    
    'Internet Explorer
    
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
    
      Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
    
      Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
    
      Set colVerbs = objFolderItem.Verbs
    
      For Each objVerb in colVerbs
    
        If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
    
      Next
    
    End If
    
    'Windows Explorer
    
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
    
      Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
    
      Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
    
      Set colVerbs = objFolderItem.Verbs
    
      For Each objVerb in colVerbs
    
        If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
    
      Next
    
    End If
    
    'Windows Media Player
    
    If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
    
      Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
    
      Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
    
      Set colVerbs = objFolderItem.Verbs
    
      For Each objVerb in colVerbs
    
        If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
    
      Next
    
    End If
    
    

    Hi, I have heard that this code works but where do I copy and paste it/do I copy and paste it or where do I put the code?
    Thursday, March 24, 2011 9:17 PM
  • I copied the text -> saved it as scriptx.vbs  to c:\ -> ran it from c:\cscript.exe script.vbs

    Nothing happens. I'm doing this in a windows 7 32-bit machine logged in as administrator. I do not get any error messages what so ever.

    What am I missing?


    Jowi Bronson
    Thursday, March 31, 2011 11:57 AM
  • Jowi,

    Did you make sure that you had all non code lines commented out? In VBS files anything before a new line and after a single quote ' is a comment. For what's listed above just copy everything beginning from the line that says Options Explicit and it should work for you. In fact, you should see those icons disappear almost immediately. Make sure you are logged in to the machine with an account that has admin access, too.

    Monday, May 16, 2011 3:36 PM
  • The above script works correcty only in if you have English language set on you Windows.

    For other language you should find translated string "Unpin from Taskbar". For example in Polish language it is "Odepnij od paska zadań". 

    Friday, February 10, 2012 12:05 PM
  • Can this work with pinning icons as well as unpinning them?  How about icons pinned to the start menu?
    Thursday, August 2, 2012 5:21 PM
  • This script works.

    'Credit goes to Eric G. for writing this script.
    'More info at http://frontslash.wordpress.com/2010/03/01/removing-internet-explorer-and-windows-media-player-from-taskbar/#comment-178
    
    Option Explicit
    
    Const CSIDL_COMMON_PROGRAMS = &H17
    Const CSIDL_PROGRAMS = &H2
    Const CSIDL_STARTMENU = &HB
    
    Dim objShell, objFSO
    Dim objCurrentUserStartFolder
    Dim strCurrentUserStartFolderPath
    Dim objAllUsersProgramsFolder
    Dim strAllUsersProgramsPath
    Dim objFolder
    Dim objFolderItem
    Dim colVerbs
    Dim objVerb
    
    Set objShell = CreateObject("Shell.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
    
    'Internet Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
        Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
        Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
        Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    'Windows Media Player
    If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
        Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If
    
    I tested this script out and it does indeed remove the default icons from the Task Bar on any user that signs in. However, it makes the background of the users' screen black. Where in the above script does it do that so I can remove it? Is it an entirely different issue? I would like to use it but would like the background issue resolved. Thank you.
    Wednesday, October 3, 2012 10:05 PM
  • danny_cc999,

    Copy everything from "Option Explicit" down.  Paste it into a Notepad file.  Name it and add the ".vbs" extension.  Then you put that file in the StartUp folder here: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup.

    Wednesday, October 3, 2012 10:13 PM
  • Do you think this script could be used as a GPO logon script instead of placing it in the local startup folder?

    Tuesday, October 30, 2012 9:15 PM
  • I don't see why not.

    If you can't, then just make a script installing it to the local folder of all your machines.

    Thursday, July 25, 2013 9:39 PM
  • Thanks, works a treat.

    Ramu V Ramanan

    Tuesday, September 10, 2013 3:00 AM
  • this script worked like a charm to me on Windows 7 English, however i need to run the same on windows 7 Arabic. 

    Please help me

    Regards

    Abdul

    Monday, March 24, 2014 11:32 AM
  • In that case, you have to replace the part

    Unpin from Taskbar

    with that what is in your right-click menu of the link of Internet Explorer

    In Germany it is

    Von Taskleiste lösen

    Thursday, January 29, 2015 12:28 PM
  • You can even add icons by replacing this string with Pin to taskbar / An Taskleiste anheften

    If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Outlook 2010.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
        Set objFolderItem = objFolder.ParseName("Microsoft Outlook 2010.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "An Taskleiste anheften" Then objVerb.DoIt
        Next
    End If
    
    If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Office Outlook 2007.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
        Set objFolderItem = objFolder.ParseName("Microsoft Office Outlook 2007.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "An Taskleiste anheften" Then objVerb.DoIt
        Next
    End If

    Thursday, January 29, 2015 12:37 PM
  • Old thread I know, but I needed to get rid of the Media Player icon that was pinned.  I used the VBScript and just deleted the Internet Explorer and Windows Explorer sections.  Worked like a charm - THANKS!!!!

    Dave


    Dave

    Thursday, June 4, 2015 3:47 PM
  • You can even add icons by replacing this string with Pin to taskbar / An Taskleiste anheften

    If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Outlook 2010.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
        Set objFolderItem = objFolder.ParseName("Microsoft Outlook 2010.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "An Taskleiste anheften" Then objVerb.DoIt
        Next
    End If
    
    If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Office Outlook 2007.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
        Set objFolderItem = objFolder.ParseName("Microsoft Office Outlook 2007.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "An Taskleiste anheften" Then objVerb.DoIt
        Next
    End If

    Funktioniert das bei jemandem?

    Bei mir leider (auch auf deutsch) nicht.

    Ich suche aber genau so ein Script um nicht nur WMP und IE dort weg zu bekommen (das klappt mit dem Script oben sehr gut), sondern um auch Firefox und Word dazu zu bekommen.

    Ich habe das Script in

    \\<DomainController>\NETLOGON\Default User.v2\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    so das es jeder neue User bekommt.

    Eigentlich müsste man es nach erstmaliger Anmeldung/Ausführen dann auch wieder löschen lassen.

    SORRY FOR THE BAD ENGLISH:

    Does it workwith someone?

    With menot (alsoin German).

    Seekingbut just as a scripttonot onlyWMPand IEto getthere way(that works with the scriptabovevery good),butto also getFirefoxandWordto.


    I have the script in

    \\<DomainController>\NETLOGON\Default User.v2\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    so that it gets each new user.


    Actually one would have it after the first login/Run then delete.


    • Edited by Win2k8-Server Wednesday, September 9, 2015 1:29 PM edit
    Wednesday, September 9, 2015 1:27 PM
  • For people using Windows 7 in French the correct string to replace "Unpin from Taskbar" in the script is : "Détacher de la barre des tâches"

    I took some time to find it :)

    Thursday, October 29, 2015 10:29 AM
  • Hi,

    Old thread I know and sorry for piggy backing on, however I need to remove the rubbish Acer Welcome Center from the taskbar of all our 64biot windows 7 machines. I tried to edit the above script:

    Option Explicit

    Const CSIDL_COMMON_PROGRAMS = &H17
    Const CSIDL_PROGRAMS = &H2
    Const CSIDL_STARTMENU = &HB

    Dim objShell, objFSO
    Dim objCurrentUserStartFolder
    Dim strCurrentUserStartFolderPath
    Dim objAllUsersProgramsFolder
    Dim strAllUsersProgramsPath
    Dim objFolder
    Dim objFolderItem
    Dim colVerbs
    Dim objVerb

    Set objShell = CreateObject("Shell.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
    strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
    Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
    strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path

    'Windows Media Player
    If objFSO.FileExists(strAllUsersProgramsPath & "Acer\Welcome Center.lnk") Then
        Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
        Set objFolderItem = objFolder.ParseName("Welcome Centerr.lnk")
        Set colVerbs = objFolderItem.Verbs
        For Each objVerb in colVerbs
            If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
        Next
    End If

    The location of the welcome center is: c:\programdata\microsoft\windows\start menu\programs\Acer

    Any help would be brilliant.

    Wednesday, December 23, 2015 10:39 AM
  • it looks like there might be a few small syntax errors

    If objFSO.FileExists(strAllUsersProgramsPath & "Acer\Welcome Center.lnk") Then


    should be

    If objFSO.FileExists(strAllUsersProgramsPath & "\Acer\Welcome Center.lnk") Then

    (strAllUsersProgramsPath sets the path to C:\ProgramData\Microsoft\Windows\Start Menu\Programs, and you want the full path to be C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Acer\Welcome Center.lnk (you could also try just skipping the variable part and putting the full path in there to see if it works, just don't forget quotes around the full path)

    also

    Set objFolder = objShell.Namespace(strAllUsersProgramsPath)

    should be

    Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Acer")
    I believe, and finally,
     Set objFolderItem = objFolder.ParseName("Welcome Centerr.lnk")

    has two r's in Welcom Center

    hope that helps a bit (note, an not an expert at vb, and am working on putting this together myself, so I could be a ittle bit off on some of this stuff)


    • Edited by hantoz Tuesday, January 5, 2016 7:19 PM I can't read and was looking at the wrong thing for CSIDL_COMMON_PROGRAMS https://technet.microsoft.com/en-us/library/dd560744(v=ws.10).aspx
    Tuesday, January 5, 2016 7:01 PM
  • Hello All 

    My requirement is to just pin internet explorer icon to taskbar in Windows 10 for all users.

    What changes do i need to make in the script?. Can anyone help ?

    Thank you in advance.


    Sourabh Kanoongo

    Friday, February 2, 2018 3:40 PM
  • thanks dure mon pote
    Sunday, October 14, 2018 2:01 PM