Tech Support Guy banner
Status
Not open for further replies.

VBS script works in Windows 7 but not Windows 10

2K views 1 reply 1 participant last post by  Couriant 
#1 ·
Hello fellow members!

I was wondering if anyone has more knowledge (which I would think that's all of you) on windows scripting that could help me with this. We have a script where it will remove / add shortcuts to the Task Bar. In Windows 7 it works fine but in Windows 10 it does not. The script is (truncated):

Option Explicit

Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Const CSIDL_STARTMENU = &HB

Dim objShell, objFSO
Dim objCurrentUserStartFolder
Dim strCurrentUserStartFolderPath
Dim objAllUsersProgramsFolder
Dim strAllUsersProgramsPath
Dim objFolder
Dim objFolderItem
Dim colVerbs
Dim objVerb

Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path

' - Pin to Taskbar -

'Adobe Muse CC 2015
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Adobe Premiere Pro CC 2015.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
Set objFolderItem = objFolder.ParseName("Adobe Premiere Pro CC 2015.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If


Can someone point me to the right direction?
 
See less See more
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top