Pin Items to Task Bar

Problem:  How do I pin items to the taskbar during deployment?

Solution:   After deployment of a server I feel its nice to have your common programs pinned to the taskbar to enable quick launch after you’ve finished.  In my line of work we have three main servers we use at each site and we separate roles & services accordingly.  The script below covers pinning a few different items to the task bar some programs some MMC Consoles.  This is one script made from 3, feel free to edit as you see fit and drop parts onto other scripts.

First we declare $shell as a new object with the type configured as “Shell.Application”

   1: $shell = new-object -com "Shell.Application" 

Then we specify the folder where the program resides

   1: $folder = $shell.Namespace('c:\program files\internet explorer')

The name of the program within that folder (including the file extension)

   1: $item = $folder.Parsename('iexplore.exe')

And finally pin it to the taskbar

   1: item.invokeverb('taskbarpin')

I have selected parts of the script below running at the end of my task sequences for each of my servers, pinning the most commonly used programs to the taskbar for use by other admins and myself when remoting on.

Here is the scripts i put together this morning, it includes taskbar pins for:

  • Internet Explorer
  • MDT Deployment Workbench
  • AD Users and Computer
  • DHCP
  • DNS
  • Group Policy
  • WSUS
  • WDS

It should also give you a head start on how to edit this for your specific needs.

   1: <#
   2: Script to Pin Programs to the taskbar
   3:  
   4: Author:  Jonathan of www.deploymentshare.com
   5: Version: 1.0.0
   6:  
   7: #>
   8: $shell = new-object -com "Shell.Application"    
   9:  
  10: # Internet Explorer    
  11: $folder = $shell.Namespace('c:\program files\internet explorer')   
  12: $item = $folder.Parsename('iexplore.exe')  
  13: $item.invokeverb('taskbarpin')  
  14:  
  15: # MDT Deployment Workbench  
  16: $folder = $shell.Namespace('C:\Program Files\Microsoft Deployment Toolkit\Bin')  
  17: $item = $folder.Parsename('DeploymentWorkbench.msc')  
  18: $item.invokeverb('taskbarpin')  
  19:  
  20: # AD Users and Computers  
  21: $folder = $shell.Namespace('c:\windows\system32')  
  22: $item = $folder.Parsename('dsa.msc')  
  23: $item.invokeverb('taskbarpin')  
  24:  
  25: # DHCP  
  26: $folder = $shell.Namespace('c:\windows\system32')  
  27: $item = $folder.Parsename('dhcpmgmt.msc')  
  28: $item.invokeverb('taskbarpin')  
  29:  
  30: # DNS  
  31: $folder = $shell.Namespace('c:\windows\system32')  
  32: $item = $folder.Parsename('dnsmgmt.msc')  
  33: $item.invokeverb('taskbarpin')  
  34:  
  35: # Group Policy  
  36: $folder = $shell.Namespace('c:\windows\system32')  
  37: $item = $folder.Parsename('gpmc.msc')  
  38: $item.invokeverb('taskbarpin')  
  39:  
  40: # WSUS  
  41: $folder = $shell.Namespace('c:\program files\update services\administrationSnapin')  
  42: $item = $folder.Parsename('wsus.msc')  
  43: $item.invokeverb('taskbarpin')  
  44:  
  45: # WDS
  46: $folder = $shell.Namespace('c:\windows\system32')  
  47: $item = $folder.Parsename('WdsMgmt.msc')  
  48: $item.invokeverb('taskbarpin')

Thanks, and Happy New Year to all my readers!

Jonathan