On Windows PowerShell and other admin-related topics

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.


February 26, 2010 - Posted by | Desktop management, Windows 7, Windows PowerShell, Windows Server 2008 R2 |


  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:\windows\explorer.exe h:\”

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

    Path does not exist.
    c:\windows\explorer.exe h:\

    Do you know of any solution to this?


    Comment by Thomas Christiansen | July 13, 2010 | Reply

  2. Thomas, this is due to Test-Path exepecting a filepath without any additional data.
    To suit your needs you might have to tweak the module a little bit.

    Comment by Jan Egil Ring | August 5, 2010 | Reply

  3. Thanks a lot, it worked flawlessly to pin outlook 🙂

    Comment by Michel | August 25, 2010 | Reply

  4. Great script! Makes Windows 7 deployment desktops much more tidy.

    Is it possible to pin to all users?


    Comment by Jan-Tore Skålnes | January 14, 2011 | Reply

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

    Set-PinnedApplication-Action PinToTaskbar-FilePath %ProgramFiles%\Google\Chrome\Application\chrome.exe

    Comment by Danishru | June 24, 2011 | Reply

    • Hi,
      In PowerShell we can use the $env: variable to access environment variables. I.e. $env:ProgramFiles\Google\Chrome\Application\chrome.exe

      Comment by Jan Egil Ring | June 26, 2011 | Reply

  6. 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.)

    Comment by Jonathan | July 29, 2011 | Reply

    • Honestly I don`t know, but I`d guess it`s possible since you can do it manually by using shift+right click. I`ll let you know if I find out.

      Comment by Jan Egil Ring | August 4, 2011 | Reply

  7. I need to set a pinned icon that launches two executables, e.g. “C:\Program Files\SIMS\SIMS .net\SIMSLoad.exe” “C:\Program Files\SIMS\SIMS .net\Pulsar.exe”, is it possible to do this?

    Comment by Martin | August 17, 2011 | Reply

    • To be able to launch several exe-files I guess you`d have to put them in a cmd/bat-file. I haven`t 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.

      Comment by Jan Egil Ring | August 17, 2011 | Reply

  8. 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

    Comment by Tom | August 18, 2011 | Reply

    • No, you could run it only once per user if needed. However if the user unpins a program the program won`t be re-pinned if the script is`n run for every logon.
      You can place the psm1–file in the following folder on a terminalserver: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PinnedApplications

      Comment by Jan Egil Ring | August 18, 2011 | Reply

  9. 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

    Comment by Tom | August 18, 2011 | Reply

    • 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.

      Comment by Jan Egil Ring | August 18, 2011 | Reply

  10. 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

    Comment by Tom | August 18, 2011 | Reply

  11. […] Microsoft for making this so easy! There’s also a custom PowerShell module you can use to pin / unpin icons, but this didn’t support command line switches. What I mean […]

    Pingback by Pin Applications to Start Menu for All Users with GPO | May 23, 2012 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: