Pin and unpin applications from the taskbar and Start-menu using Windows PowerShell

I`ve created a PowerShell module for working with pinned applications in Windows 7 and Windows Server 2008 R2. The module are created based on a script created by Ragnar Harper and Kristian Svantorp.

The module are available here, on the TechNet Script Center Gallery.

Installation and usage

Modules in Windows PowerShell can be “installed” in two ways:

1) Save the module as a psm1-file, and store it in a folder with the same name as the psm1-file. Copy this folder, using i.e. xcopy or Copy-Item, to a desired PowerShell module-folder (see available module paths using $env:PSModulePath)

2) Import the module by calling the psm1-file directly.

The first option are preferred for production use.

Next, import the module using Import-Module:

(Option 1)

(Option 2)

The module consist of one function as shown here:


The help text are available with Get-Help:


For example usage, add –Examples to the Get-Help cmdlet:


Basic error checking for valid parameters are included:


The Set-PinnedApplication function supports the en-us and nb-no locales as-is, but you can easily add support for more locales.

Feel free to let me know in the comment section below if you got any feedback.

Update, 06.08.2010: A new version of the module are now published at the original link on the TechNet Script Center Gallery. In the new version, there are full MUI support, after an update by Johan Akerstrom.

20 thoughts on “Pin and unpin applications from the taskbar and Start-menu using Windows PowerShell

  1. Very nice module.

    I have one problem though. I cant pin an application with a parameter.

    For example:
    Set-PinnedApplication -Action PinToTaskbar -FilePath “c:windowsexplorer.exe h:”

    This returns:
    Test-Path : The given path’s format is not supported.
    At C:Windowssystem32WindowsPowerShellv1.0ModulesPinnedApplicationsPinnedApplications.psm1:60 char:26
    + if(-not (test-path <<<< $FilePath)) { write-warning "nPath does not exist.n $FilePath nExiting... n"; return }
    + CategoryInfo : InvalidOperation: (C:windowsexplorer.exe h::String) [Test-Path], NotSupportedException
    + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand

    Path does not exist.
    c:windowsexplorer.exe h:

    Do you know of any solution to this?


  2. How to make possible in a way -FilePath to specify a variable?
    For example so

    Set-PinnedApplication-Action PinToTaskbar-FilePath %ProgramFiles%GoogleChromeApplicationchrome.exe

  3. Is there a way we can pin non-exe files to the Start menu as well? I understand that you go through the verbs , find the “Pin to start menu” option and execute it. This option only appears for .exe files. (I know that if you shift+ right click , you will see these alternative actions for non-exe files.)

  4. I need to set a pinned icon that launches two executables, e.g. “C:Program FilesSIMSSIMS .netSIMSLoad.exe” “C:Program FilesSIMSSIMS .netPulsar.exe”, is it possible to do this?

    • To be able to launch several exe-files I guess youd have to put them in a cmd/bat-file. I havent tested pinning cmd/bat-files, however it is possible to do it manually when holding Shift + right click on the file so it should also be possible to automate the process.

  5. Must this script run every time the user logs in??
    Where should the *.psm1 file live so it can be called by a logon.bat script when people log in to a XenApp server??
    Thank you, tom

    • No, you could run it only once per user if needed. However if the user unpins a program the program wont be re-pinned if the script isn run for every logon.
      You can place the psm1–file in the following folder on a terminalserver: C:Windowssystem32WindowsPowerShellv1.0ModulesPinnedApplications

  6. 1) If I run it each time the user logs in will it pin the app multiple times to their taskbar and start menu??

    2) I notice your path says ‘1.0’, our XenApp servers are Windows 2008 R2 SP1, should it be ‘2.0’??
    I assume this module gets placed into each of our XenApp servers.

    Our current login script applies to all domain users on several different Windows OSes — it only maps network drives and can’t be taken out etc.

    3) Should I learn how to make this module/script run ONLY when they are logging into one of our XenApp servers??

    Otherwise XP or 2003 will throw errors when they can’t execute the module??

    4) Will this module work if I specify a shortcut instead of an *.exe?? (I don’t need people getting messages about Office needing to install things, smile, we just want to pin IE, word 2010, excel 2010, outlook 2010 to both taskbar and start menu plus windows explorer to start menu only)

    This blog appears to say shortcuts are better to use:

    “Update 28 April 2009 – This post originally had the sample scripts pinning the executable (calc.exe) directly. A colleague of mine pointed out that it would be better to pin the Start Menu shortcuts for items instead of directly pinning the executable. This should be done because shortcuts for Windows Installer applications are special. Launching applications using their Windows Installer shortcuts can, for example, initiate a repair of the application it if is needed. So I have changed all the samples to point to shortcuts. I have also rewritten the attached script as an MDT script and add added a function library that allows the CSIDL (constant special item ID list) values for “special” folders to be used a variables in the item path.”

    Thank you for taking time to respond…your script is easier than the one in the blog if I can get it to work properly…

    Thank you, Tom

    • 1) No, it get`s pinned only once.
      2) No, the path is still “1.0” for PowerShell 2.0 which is integrated in Windows Server 2008 R2.
      3) Yes, if not you would have to distribute the module to the clients as well (can be scripted)
      4) Yes, lnk-files can be pinned.

  7. Thank you!!

    I have asked on powershellcommunity forum how I can check for which server/computer is being logged into to deal with that issue.

    As to un-pin, maybe there’s something in group policy to prevent unpinning but allow pinning.

    Thank you, Tom

  8. Pingback: HowTo: Per Gruppenrichtlinie und PowerShell Taskleiste Elemente anheften und lösen | dertechblog

  9. Pingback: Pin Applications to Start Menu for All Users with GPO

  10. I need to run this script on hundreds of machines – how do you suggest we do that most easily. I would prefer to be able to simply put the Powershell script on a network share and then execute it remotely with GPO. Possible? I guess I have to convert the script to a “non-function” one then?