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 filesinternet 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.

<#
Script to Pin Programs to the taskbar
Author:  Jonathan of www.deploymentshare.com
Version: 1.0.0
#>
$shell = new-object -com "Shell.Application"
# Internet Explorer
$folder = $shell.Namespace('c:\program files\internet explorer')
$item = $folder.Parsename('iexplore.exe')
$item.invokeverb('taskbarpin')
# MDT Deployment Workbench
$folder = $shell.Namespace('C:\Program Files\Microsoft Deployment Toolkit\Bin')
$item = $folder.Parsename('DeploymentWorkbench.msc')
$item.invokeverb('taskbarpin')
# AD Users and Computers
$folder = $shell.Namespace('c:\windows\system32')
$item = $folder.Parsename('dsa.msc')
$item.invokeverb('taskbarpin')
# DHCP
$folder = $shell.Namespace('c:\windows\system32')
$item = $folder.Parsename('dhcpmgmt.msc')
$item.invokeverb('taskbarpin')
# DNS
$folder = $shell.Namespace('c:\windows\system32')
$item = $folder.Parsename('dnsmgmt.msc')
$item.invokeverb('taskbarpin')
# Group Policy
$folder = $shell.Namespace('c:\windows\system32')
$item = $folder.Parsename('gpmc.msc')
$item.invokeverb('taskbarpin')
# WSUS
$folder = $shell.Namespace('c:\program files\update services\administrationSnapin')
$item = $folder.Parsename('wsus.msc')
$item.invokeverb('taskbarpin')
# WDS
$folder = $shell.Namespace('c:\windows\system32')
$item = $folder.Parsename('WdsMgmt.msc')
$item.invokeverb('taskbarpin')

Thanks, and Happy New Year to all my readers!
Jonathan
 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *