Created
July 13, 2015 14:31
-
-
Save itguy51/22fbbb79d4b9aa3aaf9c to your computer and use it in GitHub Desktop.
VBScript to config pinned items.
This file contains hidden or 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
Const CSIDL_COMMON_PROGRAMS = &H17 | |
Const CSIDL_PROGRAMS = &H2 | |
Const OfficeDir = "Microsoft Office" | |
Set objShell = CreateObject("Shell.Application") | |
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS) | |
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path | |
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\" & OfficeDir) | |
Set startFldr = objShell.Namespace(strAllUsersProgramsPath) | |
Set accFldr = objShell.Namespace(strAllUsersProgramsPath & "\Accessories") | |
'Add Outlook Icon to Taskbar & Start Menu | |
Set outlookVerbs = objFolder.ParseName("Microsoft Outlook 2010.lnk").Verbs | |
For Each objVerb in outlookVerbs | |
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt | |
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt | |
Next | |
'Add Word Icon to Taskbar & Start Menu | |
Set outlookVerbs = objFolder.ParseName("Microsoft Word 2010.lnk").Verbs | |
For Each objVerb in outlookVerbs | |
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt | |
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt | |
Next | |
'Add Excel Icon to Taskbar & Start Menu | |
Set outlookVerbs = objFolder.ParseName("Microsoft Excel 2010.lnk").Verbs | |
For Each objVerb in outlookVerbs | |
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt | |
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt | |
Next | |
'Add Snipping Tool Icon to Taskbar & Start Menu | |
Set st = accFldr.ParseName("Snipping Tool.lnk").Verbs | |
For Each objVerb in st | |
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt | |
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt | |
Next | |
'Make WMP icon disappear from TB. | |
Set WMPVerbs = startFldr.ParseName("Windows Media Player.lnk").Verbs | |
For Each objVerb in WMPVerbs | |
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment