Pin to Taskbar script

Pin to Taskbar script

This is a short vbscript to pin programs to the taskbar.

The script can for example be used in a login script.

Set objShell = CreateObject(“Shell.Application”)

Set oShell = CreateObject(“WScript.Shell”)

Set ofso = CreateObject(“Scripting.FileSystemObject”)


strFile = “C:Program Files (x86)Microsoft OfficeOffice12OUTLOOK.EXE”



strFile = “C:Program Files (x86)Microsoft OfficeOffice12WINWORD.EXE”




sub PinToTaskBar


if ofso.fileexists(strFile) then

   Set objFolder = objShell.Namespace(ofso.GetParentFolderName(strFile))

   Set objFolderItem = objFolder.ParseName(ofso.GetFileName(strFile))

   Set colVerbs = objFolderItem.Verbs

   For Each objVerb in colVerbs

      If Replace(, “&”, “”) = “Pin to Taskbar” Then objVerb.DoIt


End IF


End Sub

Programs pinned to taskbar:


Table of Contents

Share this post
Search blog posts
Modern Workplace consultant and a Microsoft MVP in Enterprise Mobility.
Modern Workplace consultant and a Microsoft MVP in Windows and Devices for IT.

Infrastructure architect with focus on Modern Workplace and Microsoft 365 security.

Cloud & security specialist with focus on Microsoft backend products and cloud technologies.

Cloud & Security Specialist, with a passion for all things Cybersecurity

Cloud and infrastructure security specialist with background in networking.

Infrastructure architect with focus on design, implementation, migration and consolidation.

Infrastructure consultant with focus on cloud solutions in Office365 and Azure.

follow us in feedly

Follow on SoMe