-
-
Save aadennis/89c55bbc5d1825c53e3c3f8ce752dc1d to your computer and use it in GitHub Desktop.
Pin a named set of applications to the task bar (e.g. Notepad++, SSMS, VS Code)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pin a named set of applications to the task bar (e.g. Notepad++, SSMS, VS Code) | |
# If there are programs on different drives (e.g. Code on c:, SSMS on f:), | |
# then a little refactoring is in order. | |
$application = New-Object -ComObject shell.application | |
# Programs required | |
$appSet = 'Notepad++\Notepad++.exe', 'Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe' | |
# All assumed to be under this root... | |
$CProgramFiles86 = "C:\Program Files (x86)" | |
"Pinning programs from [$CProgramFiles86] to the taskbar..." | |
$ns = $application.NameSpace($CProgramFiles86) | |
if ($ns -eq $null) { | |
"Error 1: [$CProgramFiles86] is null. Exiting..." | |
throw | |
} | |
$appSet | % { | |
$currentProgram = $_ | |
"Pinning [$currentProgram]" | |
$pn = $ns.ParseName($currentProgram) | |
if ($pn -eq $null) { | |
"Error 2: [$currentProgram] was not found. Exiting..." | |
return | |
} | |
$pn.InvokeVerb('TaskbarPin') | |
} | |
"Done" | |
#https://chocolatey.org/packages/notepadplusplus | |
# iwr https://chocolatey.org/install.ps1 | iex | |
# choco install notepadplusplus -y -dir="c:\TEMP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment