PowerShell script exchange
Post Reply
Posts: 2
Liked: never
Joined: Oct 09, 2017 11:29 pm
Full Name: Dennis Stroble

PowerShell command to PIN apps to Windows taskbar

Post by IT007z »

I'm looking for a PowerShell command or script that will pin these applications that I commonly use to the Windows taskbar at the bottom of Windows. (I have included the path to these programs):

1. Computer management. Path: %windir%\system32\compmgmt.msc

2. The Windows PowerShell icon. Path: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe

3. The Task Scheduler icon Path: %windir%\system32\taskschd.msc

4. The command prompt icon. Path: %windir%\system32\cmd.exe

5. The Internet Information Services (IIS) Manager icon. Path: %windir%\system32\inetsrv\InetMgr.exe

6. The Notepad icon. Path: %windir%\system32\notepad.exe

This script will mostly be used in environments where I don't have access to Active Directory or Group Policy but where I can have the AD team put in a PowerShell script to run one time on several servers or where I will be running this PowerShell script whenever necessary on the individual servers and workstations that I am customizing.

Someone wrote the following script which needs just a few more modifications until it will work properly:

Code: Select all

function New-ShortCut
        [ValidateScript({ Test-Path -path $_ })]
        [string] $sourceExe,


            (Test-Path -path $_) -and ( (Get-Item -path $_).PSIsContainer )

        [string] $DestinationLinkName = '{0}\temp.lnk' -f  [environment]::GetFolderPath("desktop"),

        [string]$WindowStyle = 'Default',

        [ValidateScript({ Test-Path -path $_ })]

        [ValidateScript({ $null -ne $IconPath })]



    $wshShell = New-Object -ComObject WScript.Shell

    $WindowStyles = @{
        Default     = 1
        Maximized   = 3
        Minimized   = 7

    $shortcut = $wshShell.CreateShortcut( $DestinationLinkName )
    $shortcut.TargetPath = $sourceExe
    if ($arguments)         { $shortcut.Arguments = $Arguments }
    if ($WorkingDirectory)  { $shortcut.WorkingDirectory = $WorkingDirectory }
    if ($WindowStyle)       { $shortcut.WindowStyle = $WindowStyles.$WindowStyle }
    if ($HotKeyString)      { $shortcut.Hotkey = $HotKeyString}
    if ($IconPath) {
        if ($IconIndexNumber) {
            $shortcut.IconLocation = '{0},{1}' -f $IconPath,$IconIndexNumber
        else {
            $shortcut.IconLocation = $IconPath

    $null = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($wshShell)

.\New-ShortCut -sourceExe 'c:\windows\System32\mmc.exe' -arguments 'compmgmt.msc' -DestinationLinkName $env:userprofile\desktop\ComputerManagement.lnk

.\New-Shortcut -sourceExe 'c:\windows\system32\windowspowershell\v1.0\powershell.exe' -DestinationLinkName $env:userprofile\desktop\powershell.lnk

Veeam Software
Posts: 209
Liked: 71 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX

Re: PowerShell command to PIN apps to Windows taskbar

Post by jhoughes »

I'm sorry, but I'm somewhat confused with this request.

What does this have to do with Veeam?
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | VMUG US South Regional Champion | VMware vExpert | Cisco Champion

Veeam Software
Posts: 510
Liked: 176 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov

Re: PowerShell command to PIN apps to Windows taskbar

Post by oleg.feoktistov »

Hi Dennis,

No doubt, this is a subform for powershell lovers and evangelists, but also a place where we exchange knowledge on Veeam-related powershell topics. Your questions are a good fit for Microsoft Technet Forums, so I'd start there.


Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests