The Windows 8.1 Update pins the Windows Store app to the Taskbar by default. No Group Policy exists that allows you to remove the icon. However, you can unpin the Windows Store app from the Taskbar with a PowerShell logon script.
Latest posts by Michael Pietroforte (see all)

In the first post of this series, I outlined why you probably don’t want your users to install apps from the Windows Store. If you just disable the Windows Store via Group Policy, many users will click the Store app anyway, which is now right in front of their nose on the Taskbar.

Windows Store app pinned to Taskbar

Windows Store app pinned to Taskbar

The following error message will probably trigger many help desk calls:

Contact your system administrator for more information

“Contact your system administrator” message

If you don’t want to be contacted for more information, you must unpin the Store icon from the Taskbar. Doing so isn’t as easy as it should be, but PowerShell is powerful enough to accomplish this daunting task. Please note that “programmatically changing the Taskbar pins is not supported or encouraged by Microsoft.”

Nevertheless, MVP Jan Egil Ring posted a PowerShell module on TechNet that allows you to pin and unpin applications from the Taskbar and Start Menu. I used Jan’s function Set-PinnedApplication in the module for the following PowerShell script. The last seven lines seven lines are mine.

Remove Windows Store app from Taskbar ^

function Set-PinnedApplication 
{ 
<#   
  AUTHOR of function Set-PinnedApplication: Jan Egil Ring, Crayon
  More info: http://gallery.technet.microsoft.com/scriptcenter/b66434f1-4b3f-4a94-8dc3-e406eb30b750
#>  
       [CmdletBinding()] 
       param( 
      [Parameter(Mandatory=$true)][string]$Action,  
      [Parameter(Mandatory=$true)][string]$FilePath 
       ) 
       if(-not (test-path $FilePath)) {  
           throw "FilePath does not exist."   
    } 
    
       function InvokeVerb { 
           param([string]$FilePath,$verb) 
        $verb = $verb.Replace("&","") 
        $path= split-path $FilePath 
        $shell=new-object -com "Shell.Application"  
        $folder=$shell.Namespace($path)    
        $item = $folder.Parsename((split-path $FilePath -leaf)) 
        $itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb} 
        if($itemVerb -eq $null){ 
            throw "Verb $verb not found."             
        } else { 
            $itemVerb.DoIt() 
        } 
            
       } 
    function GetVerb { 
        param([int]$verbId) 
        try { 
            $t = [type]"CosmosKey.Util.MuiHelper" 
        } catch { 
            $def = [Text.StringBuilder]"" 
            [void]$def.AppendLine('[DllImport("user32.dll")]') 
            [void]$def.AppendLine('public static extern int LoadString(IntPtr h,uint id, System.Text.StringBuilder sb,int maxBuffer);') 
            [void]$def.AppendLine('[DllImport("kernel32.dll")]') 
            [void]$def.AppendLine('public static extern IntPtr LoadLibrary(string s);') 
            add-type -MemberDefinition $def.ToString() -name MuiHelper -namespace CosmosKey.Util             
        } 
        if($global:CosmosKey_Utils_MuiHelper_Shell32 -eq $null){         
            $global:CosmosKey_Utils_MuiHelper_Shell32 = [CosmosKey.Util.MuiHelper]::LoadLibrary("shell32.dll") 
        } 
        $maxVerbLength=255 
        $verbBuilder = new-object Text.StringBuilder "",$maxVerbLength 
        [void][CosmosKey.Util.MuiHelper]::LoadString($CosmosKey_Utils_MuiHelper_Shell32,$verbId,$verbBuilder,$maxVerbLength) 
        return $verbBuilder.ToString() 
    } 
 
    $verbs = @{  
        "PintoStartMenu"=5381 
        "UnpinfromStartMenu"=5382 
        "PintoTaskbar"=5386 
        "UnpinfromTaskbar"=5387 
    } 
        
    if($verbs.$Action -eq $null){ 
           Throw "Action $action not supported`nSupported actions are:`n`tPintoStartMenu`n`tUnpinfromStartMenu`n`tPintoTaskbar`n`tUnpinfromTaskbar" 
    } 
    InvokeVerb -FilePath $FilePath -Verb $(GetVerb -VerbId $verbs.$action) 
}

<# Michael's unorthodox code #>

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Store.lnk")
$Shortcut.TargetPath = "C:\Windows\WinStore\WinStore.htm"
$Shortcut.Save()
Set-PinnedApplication -Action PintoTaskbar -FilePath "$env:USERPROFILE\Store.lnk"
Set-PinnedApplication -Action UnPinFromTaskbar -FilePath "$env:USERPROFILE\Store.lnk"
Remove-Item $env:USERPROFILE\Store.lnk

The Set-PinnedApplication function takes shortcuts as input, but for some reason the function doesn’t accept the original Windows Store link (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Store.lnk). Other Modern app shortcuts in this folder, such as the Camera.lnk, work. That is why the script first creates a new shortcut with the same target path, which I save in the user’s profile. I then pin this link to the Taskbar and delete it again in the next line. This will also remove the original Store link from the Taskbar. The last line deletes the shortcut from the user’s profile.

Launch PowerShell script at user logon ^

You can’t run this PowerShell script as a normal logon script (Windows Settings > Scripts) because these logon scripts run right after the user logs on and before the user’s desktop is available. This is why you have to use the Group Policy setting “Run these programs at user logon” in User Configuration > Administrative Templates > System > Logon.

Run these programs at user logon

Run these programs at user logon

This Group Policy setting for logon scripts doesn't allow you to run PowerShell scripts directly. Thus, you have to launch the script through the powershell command:

powershell \\win2012r2\scripts\store.ps1

In my example, the PowerShell scripts is stored on the network share “scripts” on the server “win2012r2.”

Items to run at logon

Items to run at logon

Notice that your users will momentarily see a PowerShell command window after they logged in. I will show you in an upcoming post how to deal with such popup windows in logon scripts. I know that the entire procedure is a bit unorthodox, but it works. If you know of a better way, feel free to share it in the comment section below.

Conclusion ^

If you don’t want your users to install apps from the Windows Store, you have to do three things: disable the Windows Store, remove the Windows Store from the Start Screen, and unpin the Store icon from the Taskbar. I am hoping that Windows 9 will have a Group Policy setting that allows you to do this for your entire network with just one click. Another option exists which allows you to configure the pinned apps on the Taskbar with Group Policy. I will discuss this solution another post. Stay tuned!

11 Comments
  1. Bernhard 7 years ago

    The August update, 2975719, now provides a new GPO setting to improve options.

    The new GPO is called: "Do not allow pinning Store app to the Taskbar"

    The full path to the new GPO is: "User Configuration\Administrative Templates\Start Menu and Taskbar\Do not allow pinning Store app to the Taskbar"

  2. Bernand, interesting. Thanks for the hint. I will try that.

  3. Jeff 6 years ago

    On win10:

    Set-PinnedApplication -Action PinToTaskbar -FilePath "C:\WINDOWS\system32\notepad.exe"

    Verb Pin to taskbar not found.
    At C:\Users\id\Desktop\PinnedApplications.psm1:65 char:13
    + throw "Verb $verb not found."
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Verb Pin to taskbar not found.:String) [], RuntimeException
    + FullyQualifiedErrorId : Verb Pin to taskbar not found.

  4. Jeff, I tried the module on Windows 10 and I received the same error message.

  5. Steve Paynter 6 years ago

    In Windows 10 attempting to remove Microsoft Edge from the taskbar using this module and receiving this error in PS:

    Verb Pin to taskbar not found.
    At C:\Users\Steve\Documents\WindowsPowerShell\Modules\PinnedApplications\PinnedApplications.psm1:65 char:13
    + throw "Verb $verb not found."
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Verb Pin to taskbar not found.:String) [], RuntimeException
    + FullyQualifiedErrorId : Verb Pin to taskbar not found.

  6. Simon 6 years ago

    Read this and you can figure out how to unpin Edge.
    http://ccmexec.com/2015/12/removing-the-edge-icon-from-the-taskbar-during-osd

  7. Vic 6 years ago

    Thanks for the post!

    On Windows Server 2012 R2, I was able to unpin the Store from the taskbar. Windows may tell you that the file name is Store.lnk. A Command Prompt told me it was Windows Store.lnk. The following three lines worked interactively in a PowerShell window. Scripts can be adapted as needed.

    $sa = new-object -c shell.application
    $pn = $sa.namespace((Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs')).parsename('Windows Store.lnk')
    $pn.invokeverb('taskbarunpin')

  8. uwe 5 years ago

    Thanks for your post.

    I only had to add -ErrorAction  SilentlyContinue  to all Set-PinnedApplication commands. Without it the script throws an error and stops.
    Set-PinnedApplication -Action PintoTaskbar -FilePath "$env:USERPROFILE\Store.lnk" -ErrorAction  SilentlyContinue

    Set-PinnedApplication -Action UnPinFromTaskbar -FilePath "$env:USERPROFILE\Store.lnk" -ErrorAction  SilentlyContinue

    Tested on terminal server 2012 r2 (with user logon script).

  9. Rob Nicholson 2 years ago

    Sadly I get the same "Verb Pint to taskbar" not found on Windows 10 🙁 Did we ever get a fix for this?

    avatar

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2021

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