Skip to content

No way to pin/unpin apps in Sandbox? #119

@Wallby

Description

@Wallby

Provide a description of requested docs changes

Sandbox version: 0.5.3.0
Build number: 10.0.26200.0

What I've tried

Create a custom shortcut in either one of the special folders StartMenu or CommonStartMenu
For this I use WScript.Shell from powershell.

The below code is missing some safety checks and relevant code intentionally to keep this report short.

$wshShell = New-Object -ComObject 'WScript.Shell'
$shortcut = $wshShell.CreateShortcut('$appFolder\$appName.lnk')
$shortcut.TargetPath = '...'
$shortcut.Arguments = '...'
$shortcut.Save()

One option to pin/unpin that I found is to use context menus.
Either by opening up the virtual folder AppsFolder using Shell.Application and Shell.NameSpace.

$shellApp = New-Object -ComObject 'Shell.Application'
$appsFolder = $shellApp.NameSpace('shell:AppsFolder')
$appItem = $appsFolder.Items() | where { $_.Name -eq $appName }
$appItem.Verbs() | % { Write-Host "Verb: $($_.Name)" }
# ... <- Find pin/unpin option
$option.DoIt()

Or the shortcut in the "(Common) Start Menu" folders.

$shellApp = New-Object -ComObject 'Shell.Application'
$itemFolderPath = Split-Path $appPath -Parent
$itemName = Split-Path $appPath -Leaf
$itemFolder = $shellApp.NameSpace($itemFolderPath)
$item = $itemFolder.ParseName($itemName)
$verbs = $item.Verbs()
# ... <- Find pin/unpin option
$option.DoIt()

https://learn.microsoft.com/en-us/windows/win32/shell/folderitemverb
https://learn.microsoft.com/en-us/windows/win32/shell/folderitem

This API seems to be silently deprecated? As the pin and unpin options are the only options (as far as I've tested) that when called via DoIt always result in access denied (even outside of a Sandbox).
The same issue seems to be occurring here: https://www.windowsphoneinfo.com/threads/windows-10-1909-why-are-pin-to-start-taskbar-verbs-through-powershell-broken.292591/

An alternative there suggested is to use group policy. I tried that, but the documentation mentions logging off and on again is required, which doesn't work in Sandbox.
https://learn.microsoft.com/en-us/windows/configuration/taskbar/pinned-apps?tabs=gpo&pivots=windows-11
I tried gpupdate, but that didn't work.
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/Policy/applying-group-policy

There is no option in the specific Sandbox GSP documentation for specifying a layout .xml file.
https://learn.microsoft.com/en-us/windows/client-management/mdm/policy-csp-windowssandbox

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions