Microsoft doesn’t officially support programmatically changing the Taskbar pins. However, with the PowerShell module PinnedApplications from Jan Egil Ring, you can easily pin and unpin apps to the Taskbar on Windows 7 and Windows 8.x computers.

First, copy and paste the PowerShell module to an editor on your computer. I suggest you save the file to one of your PowerShell module folders. With $env:PSModulePath, you can get a list of your module paths.

PS C:\> $env:PSModulePath
C:\Users\administrator\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

In this example, we use C:\Users\Administrator\Documents\WindowsPowerShell\Modules. You have to create a folder with the name PinnedApplications in the module folder and then save the file as PinnedApplications.psm1 to this folder. This would be the file path:

C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PinnedApplications\PinnedApplications.psm1

Make sure your execution policy is set to unrestricted (Set-ExecutionPolicy Unrestricted). Next, you can import the module with the Import-Module cmdlet.

PS C:\> Import-Module PinnedApplications
PS C:\>

If no error message appears, you are fine. Use the Get-Command cmdlet to check what commands the module contains.

PS C:\> Get-Command -Module PinnedApplications
CommandType     Name                                               ModuleName 
-----------     ----                                               ----------
Function        Set-PinnedApplication                              PinnedApplications

From now on, you can use Set-PinnedApplication to pin and unpin apps to the Windows Taskbar.

With Get-Help Set-PinnedApplication, you get an overview of the cmdlet.

Get-Help Set-PinnedApplication

Get-Help Set-PinnedApplication

The synopsis indicates that the cmdlet was made for Windows 7 and Windows 2008 R2. I tried the module with Windows 8.1, and it appears to work fine for pinning and unpinning apps to the Taskbar. However, in my tests, the actions PinToStartMenu and UnPinFromStartMenu didn’t work on Windows 8.1 but worked well on a Windows 7 machine.

The example below demonstrates how you can pin Notepad to the Taskbar:

PS C:\> Set-PinnedApplication -Action PinToTaskbar -FilePath C:\Windows\system32\notepad.exe
PS C:\>

Notepad pinned to Taskbar

Notepad pinned to Taskbar

Wouldn’t it be wonderful if you could unpin the Store app from the Taskbar with PowerShell? It is not easy as one might think. In my next post, I show you how you can use the Set-PinnedApplication function of Jan Egil Ring’s module in a logon script so you can unpin the Store app on all computers in your network.

7 Comments
  1. Chris Zheng 8 years ago

    Can’t wait to see the next post about removing store app from taskbar by logon script!

  2. Michael Pietroforte 8 years ago

    The article is scheduled for this week.

  3. Simon 7 years ago

    Hello,
    Have this been tested on Win10?

    Best Regards,
    Simon

  4. Stéphane J. 6 years ago

    It doesn’t in W10. Verbs function is unknown.

  5. Author
    Michael Pietroforte 6 years ago

    Yes, the module doesn’t work in Windows 10. You now can pin apps to taskbar with Group Policy.

  6. Ryan Dikabo 6 years ago

    Hello,

    Is it possible to pin folders and shortcuts to the task bar using this script? For now I’m only able ton pin .exe

     

    Thanks

  7. Dave 2 years ago

    I would like to be able to pin icons to the taskbar using PowerShell within Windows 10 (instead of using group policy).

    Is there any way that this can be done within Windows 10?

    Can you provide a different PinnedApplications.psm1 file that will work within Windows 10?

Leave a reply

Your email address will not be published.

*

© 4sysops 2006 - 2022

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account