powershell - Prevent shortcuts pinned to the taskbar by a script from being removed when re-running the script -
i have script pins application shortcuts windows taskbar.
the script have works fine when pinning shortcuts. however, if script run second time remove shortcuts pinned.
the issue appears here:
$appword = "c:\temp\word.lnk" $appword = "c:\temp\excel.lnk" $apps = @($appword, $appexcel) foreach($_ in $apps) { ($shortcuts.parsename($_).verbs() | ? {$_.name -match "tas&kbar"}).doit() }
how can stop pinned items being removed if exist?
exclude verbs have word "unpin" in them:
$apps | % { $verb = $shortcuts.parsename($_).verbs() | ? { $_.name -match "tas&kbar" -and $_.name -notmatch 'unpin' } $verb.doit() }
Comments
Post a Comment