How to pin powershell scripts to taskbar? [closed]

My previous answer was wrong so I obliterated it. One cannot pin files to the taskbar. One can only pin applications to the taskbar. Files can be pinned to the "Jump List" that is associated with an application.

For example, a .txt file can't be pinned to the taskbar, but you can pin the .txt file to the jump list of Notepad.exe or WinWord.exe.

With that in mind, to pin a .ps1 file to the Taskbar, you'll need to either pin the PowerShell ISE to the taskbar and then pin the .ps1 file to the ISE, or you'll need to make a shortcut, change the target to powershell.exe and then pass your .ps1 file as an argument. That way the shortcut appears to be to an application (which it is) but it is specifically passing your script as an argument.

Other things to keep in mind is that there are restrictions based on the filename as well. Default restrictions on words in file names include:

  • Documentation
  • Help
  • Install
  • More Info
  • Readme
  • Read me
  • Read First
  • Setup
  • Support
  • What's New
  • Remove

Those word restrictions can be found at the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileAssociation\AddRemoveNames

Also, there are apparently files that cannot be pinned:

  • Applaunch.exe
  • Control.exe
  • Dfsvc.exe
  • Dllhost.exe
  • Guestmodemsg.exe
  • Hh.exe
  • Install.exe
  • Isuninst.exe
  • Lnkstub.exe
  • Mmc.exe
  • Mshta.exe
  • Msiexec.exe
  • Msoobe.exe
  • Rundll32.exe
  • Setup.exe
  • St5unst.exe
  • Unwise.exe
  • Unwise32.exe
  • Werfault.exe
  • Winhlp32.exe
  • Wlrmdr.exe
  • Wuapp.exe

The above file restrictions are found at the following registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\FileAssociation

In the end, your PowerShell file may be blocked from being pinned because there is a poison word in it.

Other References for this post are as follows:

  • http://blogs.msdn.com/b/oldnewthing/archive/2007/06/15/3301004.aspx
  • http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx#exclusion_lists

My preferred method is to create a shortcut on the desktop first and pin the shortcut to my task bar. I've also used WesleyDavid's a couple times but I don't like having to pull it from the start menu to the task bar.