c# - Pinning Metro Apps To Taskbar Windows 10 Powershell -




the following code pin metro app start given aumid

if change

-match 'pin start' 

unfortunately changing match 'pin taskbar' not work. going on here?

function pin-taskbar {    param(         [string]$aumid,         [switch]$unpin     )     try{         if ($unpin.ispresent){             ((new-object -com shell.application).namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').items() | ?{$_.path -eq $aumid}).verbs() | ?{$_.name.replace('&','') -match 'unpin taskbar'} | %{$_.doit()}             return "app '$aumid' unpinned taskbar"         }else{             ((new-object -com shell.application).namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').items() | ?{$_.path -eq $aumid}).verbs() | ?{$_.name.replace('&','') -match 'pin taskbar'} | %{$_.doit()}             return "app '$aumid' pinned taskbar"         }     }catch{         write-error "error pinning/unpinning app! (app-name correct?)"     } }   pin-taskbar king.com.candycrushsaga_kgqvnymyfvs32!app 

i assume citizen , not want spam taskbar of users.

in previous versions of windows, able use verb pintotaskbar programmatically un-/pin programs taskbar.

$shell = new-object -com "shell.application"  $folder = $shell.namespace((join-path $env:systemroot system32\windowspowershell\v1.0)) $item = $folder.parsename('powershell_ise.exe') $item.invokeverb('taskbarpin'); 

this no longer works in windows 10. verb pintotaskbar not exist accessible anymore.

hence, unapproved 3rd-party command prompt utility called syspin brought life - allows want (though not work each , every app, uwp/metro apps).

however, since windows 10 version 1607 there new official way: adding <taskbarlayout>
see: customize pinned items on taskbar in windows 10 1607 during osd configmgr





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -