Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / Pin and Unpin Apps to Taskbar in Windows 11 via PowerShell

March 10, 2026

Pin and Unpin Apps to Taskbar in Windows 11 via PowerShell

Administrators sometimes need to pin certain apps or shortcuts to folders and other items in Windows users’ taskbars programmatically. The way pinned apps and items are managed on the taskbar has changed with every new version of Windows. In particular, we found that most previously used scripts for pinning or unpinning app icons to the taskbar, which worked in previous versions, do not work in Windows 11. In this post, I will cover several PowerShell scripts that can be used to pin or unpin items to the taskbar in Windows 11 25H2.

Contents:
  • How to Pin Apps to the Taskbar in Windows Using PowerShell
  • Unpin Apps from Taskbar in Windows 11 with PowerShell

Before the release of Windows 10 21H2, it was possible to use the shell:::{4234d49b-0245-4df3-b780-3893943456e1} namespace interface via the Shell COM interface to pin shortcuts to the Windows taskbar programmatically. This namespace is available in all versions of Windows and contains all items that can be pinned or unpinned to the taskbar. You can even navigate to this path in File Explorer. However, in Windows 11, this namespace can only be used to unpin taskbar items (see below).

Previously, it was also possible to copy the required shortcuts to the %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar directory in order to pin them to the taskbar. In Windows 11, copying shortcuts manually to the \User Pinned\TaskBar folder doesn’t work either (although, in fact, this folder stores shortcuts to pinned apps).

It appears that Microsoft is deliberately closing all software methods for pinning shortcuts to the taskbar without users being aware of it. It is assumed that users can only manually pin items to the taskbar.

User Pinned\TaskBar folder in Windows

How to Pin Apps to the Taskbar in Windows Using PowerShell

To deploy a customized layout with pinned apps to the Windows 11 taskbar, you can use a special LayoutModification.xml file. You can apply an XML file that describes taskbar pinned items via Group Policy. However, this approach is not flexible for cases when you need, for example, to pin one application to a specific user’s taskbar after its installation. Pin apps to taskbar in Windows 11

The following PowerShell script creates a shortcut (.lnk) to the target application in the Start Menu (this can be any installed or portable app). The script then generates a temporary XML layout file for the taskbar in the LayoutModificationTemplate markup with a shortcut to the application and saves it to the user profile (%AppData%\Microsoft\Windows\Shell\LayoutModification.xml ). After restarting, Windows Explorer reads and applies the taskbar layout from the XML file. After applying the taskbar layout, the script resets the template cache and deletes the XML file, thereby unlocking the layout.

$PinnedAppName = "tcpview64"
$PinnedExePath = "C:\Tools\tcpview64.exe"
$PinnedLnkPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\$PinnedAppName.lnk"
if (-not (Test-Path $PinnedLnkPath)) {
$WshShell = New-Object -Com WScript.Shell
$app_shortcut = $WshShell.CreateShortcut($PinnedLnkPath)
$app_shortcut.TargetPath = $PinnedExePath
$app_shortcut.WorkingDirectory = Split-Path $PinnedExePath
$app_shortcut.IconLocation = $PinnedExePath
$app_shortcut.Save()
}
$xmlTemplate = @"
<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
Version="1">
<CustomTaskbarLayoutCollection PinListPlacement="Replace">
<defaultlayout:TaskbarLayout>
<taskbar:TaskbarPinList>
<taskbar:DesktopApp DesktopApplicationLinkPath="$PinnedLnkPath"/>
</taskbar:TaskbarPinList>
</defaultlayout:TaskbarLayout>
</CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>
"@
$xmlPath = "$env:LOCALAPPDATA\Microsoft\Windows\Shell\LayoutModification.xml"
$xmlTemplate | Out-File -FilePath $xmlPath -Encoding UTF8 -NoNewline
Remove-Item "$env:LOCALAPPDATA\Microsoft\Windows\Shell\DefaultLayouts" -Recurse -Force -ErrorAction SilentlyContinue
Stop-Process -Name explorer -Force
Start-Sleep 6
Remove-Item $xmlPath -Force -ErrorAction SilentlyContinue

Pin an app to taskbar using PowerShell script

Unlike when using GPO, this method of pinning items allows you to avoid statically fixing the app shortcut to the taskbar. If users no longer need such a pinned app, they can unpin it themselves, and it won’t return to the taskbar the next time they sign in.

The syntax used in the XML file depends on the type of application being pinned:

  • For classic Win32 apps: — <taskbar:DesktopApp> (specify either the path to the application executable or its AppID, as returned by the Get-StartApps command)
  • For Microsoft Store (UWP) apps: <taskbar:UWA> , specify the name of the app instead of its path.

To pin a Microsoft Store app, you need to get its name:

Get-AppxPackage -AllUsers| select PackageFamilyName

Specify the name and the AppID (Application User Model ID, AUMID) of the application in variables. In this example, I want to pin the Windows Terminal app:

$AppName = "Windows Terminal"
$AppID = "Microsoft.WindowsTerminal_8wekyb3d8bbwe!App"

To pin a Microsoft Store app, replace the line <taskbar:DesktopApp> in the XML with the following:

<taskbar:UWA AppUserModelID="$AppID"/>

Unpin Apps from Taskbar in Windows 11 with PowerShell

It is much easier to unpin an app from the taskbar when using PowerShell. First, list the registered programs, management consoles, and Microsoft Store apps that are available for pinning to the taskbar.

$shell = New-Object -Com Shell.Application
$shell.Namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | Select Name

Unpin taskbar item via shell.Namespace

Copy the short name of the program you want to unpin. To unpin a specific app from the taskbar using PowerShell, run the following script:

$appname = "tcpview64"
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}

Check whether the pinned app has disappeared from the taskbar.

Unpin icons from taskbar in Windows 11

​

Frequently used folders can be pinned to the Quick Access in Windows using PowerShell to make navigation easier for users.

1 comment
0
Facebook Twitter Google + Pinterest
PowerShellQuestions and AnswersWindows 11Windows Server 2025
previous post
Disable Auto Disk Check (CHKDSK) at Windows Startup

Related Reading

Uninstalling Windows Updates via CMD/PowerShell

March 10, 2026

Run Elevated Commands with Sudo on Windows 11

August 21, 2025

Automate Software and Settings Deployment with WinGet Configure...

November 20, 2025

How to Find AD Users with Blank Passwords...

August 21, 2025

Enable/Disable Random Hardware (MAC) Address for Wi-Fi on...

November 20, 2025

How to Disable PowerShell on Windows for Non-Admin...

November 27, 2025

How to Remove Old (Unused) PowerShell Modules

January 13, 2026

Where Windows Stores Certificates and Private Keys

February 9, 2026

1 comment

dk March 10, 2026 - 3:28 pm

Programmatically pinning apps to the taskbar in Windows 11 is restricted to user-initiated actions for security.

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Load and Initialize Network Drivers in Windows PE or Recovery Environment

    February 25, 2026
  • How to Set a Custom Drive Icon in Windows

    February 17, 2026
  • Managing Per-User Services in Windows

    February 11, 2026
  • Change Default OU for New Computers and Users in AD

    February 2, 2026
  • Where Windows Stores Certificates and Private Keys

    January 22, 2026
  • How to Remove Old (Unused) PowerShell Modules

    January 12, 2026
  • How to Move (Migrate) Windows Shares to a New File Server

    December 24, 2025
  • Using KDC (Kerberos) Proxy in AD for Remote Access

    December 23, 2025
  • Windows: Create (Install) a Service Manually

    December 16, 2025
  • Windows: Auto Switch to Strongest Wi-Fi Network

    December 10, 2025

Follow us

  • Facebook
  • Twitter
  • Youtube
  • Telegram
Popular Posts
  • Fix: Slow Startup of PowerShell Console and Scripts
  • Automate Software and Settings Deployment with WinGet Configure (DSC)
  • Run Elevated Commands with Sudo on Windows 11
  • How to Pause (Delay) Update Installation on Windows 11 and 10
  • Enable/Disable Random Hardware (MAC) Address for Wi-Fi on Windows
  • Windows: How to Turn Off Monitor with Command Line
  • Configure Windows to Auto Restart/Shutdown with Task Scheduler
Footer Logo

@2014 - 2026 - Windows OS Hub. All about operating systems for sysadmins


Back To Top