Prevent Items Pinning to the Taskbar (Explorer Included)

A couple of years ago, I wrote a post about preventing Internet Explorer and Media Player from pinning to the taskbar. It was a fairly simple solution, and the post continues to generate traffic to this site. Unfortunately, though, the methodology died with the Windows 7 era, and none of the advice even applies anymore. I considered updating that post with this new information, but decided this would better serve.

This method is, unfortunately, a bit more intrusive. It does, however, have the advantage of actually working. It will suffice not only for IE and Media Player, but Explorer.exe as well. My old post might work better for you if you’re on an older Windows. Should those steps fail you, though: these will not.


First, some background and a disclaimer. It is somewhat disingenuous to say we will prevent IE and company from pinning. In point of fact, we will simply be removing the icons as they are pinned, such that the user never sees them. I regret that, since 2008R2, I’ve never found a way to truly prevent them from pinning. Since then, I believe it’s been hardcoded into Windows itself, and no amount of registry, file system, or profile manipulation will get around that. I would absolutely love to be proven wrong on this point. In the meantime, though:

If you’ve done any troubleshooting on this front, you may have found that Windows treats taskbar pins somewhat strangely. It stores a .lnk file in the user profile folder, but deleting the file doesn’t remove the icon from the taskbar–it just breaks the shortcut. You may also have found the registry change at HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/Taskband. But of course, clearing that out doesn’t quite work either. And, for some reason, neither does getting rid of them both simultaneously. ¯\_(ツ)_/¯

The Resolution:

This leaves us with one option–verbs. Effectively, these are what you’re seeing whenever you right click an item. VBscript allows us to access these programmatically, and the endgame here is going to be a script at login that waits for the items to appear, then “right-clicks” and chooses to “Unpin from taskbar.” Simple enough, except for explorer.exe, which I’ll touch on afterwards. The script below is simplified (and modified) from the excellent work of the Spiceworks user ryadical, who even includes a function to pin new items as well.


Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wshShell = CreateObject( "WScript.Shell" )
strAppData = wshShell.ExpandEnvironmentStrings( "%APPDATA%" )
strUserPinned = strAppData & _
	"\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"

' Windows Explorer is called Window Explorer pre-2012, File Explorer after.
If (objFSO.FileExists(strUserPinned & "\Window Explorer.lnk")) Then
	winLNK = strUserPinned & "Window Explorer.lnk"
	winLNK = strUserPinned & "File Explorer.lnk"
End If

' ***UNPIN ITEMS*** 

' Internet Explorer
unpinFromTaskbar strUserPinned, "Internet Explorer.lnk"

' Windows/File Explorer
unpinFromTaskbar strUserPinned, winLNK

' Windows Media Player
unpinFromTaskbar strAllUsersProgramsPath, "Windows Media Player.lnk"

Function unpinFromTaskbar (strIconFolder, strIconFile)
        If objFSO.FileExists(strIconFolder & "\" & strIconFile) Then
                Set objFolder = objShell.Namespace(strIconFolder)
                Set objFolderItem = objFolder.ParseName(strIconFile)
                Set colVerbs = objFolderItem.Verbs

                For Each objVerb in colVerbs
			If InStr(Replace(,"&",""),"Unpin") _
			Then objVerb.DoIt
        End If     
End Function

The script above, if set to run at login, will remove Internet Explorer and Windows Media Player from the taskbar. It will also attempt to remove File Explorer, but depending on your version of Windows, it may fail.

As discussed above, this script will enumerate the actionable “verbs” on a given shortcut; find the one that Unpins it from the taskbar; and invoke it. The problem is that–at least on 2012R2–you may find that right-clicking the explorer icon in your taskbar does not let you unpin it. I have no idea why, but thankfully, the workaround is simple.

If you’re running into that problem, you have one additional step ahead of you. You can manually add the “unpin” verb to the File Explorer shortcut using the following registry tweak in HKEY_CLASSES_ROOT:

@=”Taskband Pin”

After doing so, you’ll notice the Pin/Unpin option has been restored to the context menu.  With that in place, the script will work the same for File Explorer as it does for any other shortcut.

Top of Page
Go Back

One thought on “Prevent Items Pinning to the Taskbar (Explorer Included)

  1. Thank you very much for solving this irritation. I used your code on my work PC to create a file I added to the Task Scheduler to run when I logon. It didn’t work. Hmmm. It worked when I just launched the script. Perhaps it’s running to soon? So I added a delay of 20 seconds. That fixed it. But, now, if I run it by double clicking the file, I wait seemingly forever. So I added the following enhancement:
    ‘ Set requested delay (if any)
    if WScript.Arguments.Count > 0 then
    Set args = Wscript.Arguments
    iDelay = args(0) * 1000
    sDelay = ” delayed ” & iDelay & ” mSec.”
    iDelay = 0
    sDelay = “.”
    end if
    WScript.Sleep iDelay

Leave a Reply

Your email address will not be published. Required fields are marked *