4

The corporate image being used on my laptop keeps forcing File Explorer to be pinned to my taskbar. I have gone round and round with them about this problem (and others I have had) but am giving up on that front since the other problems are fixed. What I want to try to accomplish as a work around is to create a script that I can run when I log in that will unpin File Explorer from the taskbar for me. I have been all over the internet with various powershell, vbscript and batch files. Most of the scripts work great for any thing pinned to the taskbar EXCEPT File Explorer. Most pinned items are in %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar and I can see File Explorer there. However all the scripts I see use the verbs of the object and look for an unpin from taskbar command and run it. File Explorer does not have that. I have searched my entire hard drive and cannot file a file with the unpin command for file explorer. If I delete the file and remove the taskband registr in HKCU the item is not longer pinned, but still shows on the taskbar. If I click it, it will crash and the remove itself. If I refresh explorer.exe, the item is pinned to the taskbar again. Any ideas on how to do this?

5
  • Not sure if this works but what if you get the TaskBar to your liking, then create the registry value: HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer "NoPinningToTaskbar"=dword:00000001 Commented Jan 9, 2018 at 20:27
  • Thanks for the idea, but unfortunately that did not work. I had to reboot to get the registry setting to implement. Upon reboot the File Explorer was back in the taskbar but now I could not unpin it manually.
    – LtlBear
    Commented Jan 10, 2018 at 20:19
  • You only need to kill and relaunch explorer.exe for it to take effect but maybe policy trumps it. Commented Jan 10, 2018 at 20:57
  • 1
    I did not think about killing explorer to make it take effect. However, killing explorer and restarting explorer pins it back to the taskbar. I don't think this is a policy thing. There are plenty of posts on the internet with people having this same problem. A good chunk of them cannot get it fixed without running a repair in Windows. Unfortunately that is not an option for me and to re-install I have to have the corporate image which has the problem built in.
    – LtlBear
    Commented Jan 11, 2018 at 18:45
  • I succeeded to overcome automatic app pinning by denying Write permission for Everyone on %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar folder.
    – yrtimiD
    Commented Jul 7, 2020 at 11:37

1 Answer 1

2

It should still work with the method used by PinTo10 which is based on this kinda crazy method where you basically rename your own executable to explorer.exe to get the privileges windows has for pinning.

It also seems you have to use a special link and not the normal one but in my tests if you use the one from "C:\ProgramData\Microsoft\Windows\Start Menu Places" it still works.

So that would be:

PinTo10v2.exe /unpintb "C:\ProgramData\Microsoft\Windows\Start Menu Places\01 - File Explorer.lnk"

If you prefer a purely scripted method (should be enough for unpinning just not for pinning) this would be something like

Set wso = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set sho = CreateObject("Shell.Application")

sourcedir = fso.GetFile(WScript.ScriptFullName).ParentFolder
Set folder = sho.Namespace("C:\ProgramData\Microsoft\Windows\Start Menu Places")

For Each item In folder.Items
    If contains(item.Name,"Explorer") Then
        item.InvokeVerb("taskbarunpin")
    End If
Next

' Funktion um zu prüfen ob ein string einen anderen enthält
Function contains(sourceStr, checkStr)  
    contains=InStr(1, sourceStr, checkStr, vbTextCompare) > 0
End Function

(I could not test it with the newest Win 10 builds but so far they did never touch this part since they made it completely intransparent with windows 10)

2
  • Amazing! I finally had time to test and got this to work. My missing piece was the file location in Start Menu Places. Since it shows there as a folder and not an exe, I did not see that in all my searches. Thanks for taking the time to help!
    – LtlBear
    Commented Jan 24, 2018 at 18:54
  • 1
    Great you got it to work! I know exactly how annoying it is that MS does not provide a proper way to unpin programmatically. I'm not even sure whether I should be mad that this stuff is so half assed or happy because at least there is atm a way for every program to unpin it even if many need special cases even if only because this is all such a mess. If you found my answer helpful feel free to mark it as accepted.
    – Syberdoor
    Commented Jan 25, 2018 at 10:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .