How do I automatically add icons to windows 7 task bar?

  • I use the Microsoft Deployment Toolkit to install images and applications using a Lite-touch installation method. I would like to automatically add the icons to the "superbar" after installation so the users will be more inclined to use the improved task bar, rather than continuing to use desktop icons.

    I understand that there is no programmatic access to the task bar to prevent applications from adding themselves to the task bar, filling it with unwanted applications. Is there a way to use MDT, or even GPO to add icons to the task bar, or shall I use a VBS to add the Start menu shortcuts to the task bar?

Answers(23)

  • Win+R does not work. :( – Mike Chess Feb 4 '10 at 18:43

      • Found this script recently appears to work when run locally, I'm new to sccm2007 having problems deploying script from Task Sequence.

        ' Windows Script Host Sample Script ' ' ------------------------------------------------------------------------ ' Copyright (C) 2009 Microsoft Corporation ' ' You have a royalty-free right to use, modify, reproduce and distribute ' the Sample Application Files (and/or any modified version) in any way ' you find useful, provided that you agree that Microsoft and the author ' have no warranty, obligations or liability for any Sample Application Files. ' ------------------------------------------------------------------------

        '***************

        ***************

        ********
        '* '* File: PinItem.vbs '* Date: 03/04/2009 '* Version: 1.0.2 '* '* Main Function: VBScipt to pin an item to the Start Menu or Taskbar '* '* Usage: cscript PinItem.vbs /item: '* [/taskbar] [/?] '* '* Copyright (C) 2009 Microsoft Corporation '* '* Revisions: '* '* 1.0.0 - 04/03/2008 - Created. '* 1.0.1 - 03/02/2009 - Used Replace in PinItem function to remove "&" '* from verb. '* 1.0.2 - 03/04/2009 - Script name was PinToStartMenu.vbs. Added '* /taskbar switch to pin items to taskbar on '* Win7. '* '******************************
          ***

          *****

            '******************

            ************************* '* Declare Variables '************
            *******************************

            Option Explicit 'On Error Resume Next

            Dim blnPinned Dim blnTaskbar

            Dim i Dim intOpMode

            Dim objWshShell Dim objFSO Dim objShell

            Dim strPath Dim strArguments Dim strOptionsMessage

            ' Define constants Const CONST_ERROR = 0 Const CONST_WSCRIPT = 1 Const CONST_CSCRIPT = 2 Const CONST_SHOW_USAGE = 3 Const CONST_PROCEED = 4 Const CONST_STRING_NOT_FOUND = -1 Const CONST_FOR_READING = 1 Const CONST_FOR_WRITING = 2 Const CONST_FOR_APPENDING = 8 Const CONST_Success = 0 Const CONST_Failure = 1

            Const TRISTATE_USE_DEFAULT = -2 Const TRISTATE_TRUE = -1 'Open the file as Unicode. Const TRISTATE_FALSE = 0 'Open the file as ASCII.

            blnTaskbar = False

            '************

              ******************
              ***

              ******
                ***
                *
                '* Create Objects '*********************************

                **********

                Set objWshShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application")

                '***************************

                ***
                ******

                **
                '* Check script host exe and parse command line '***
                  ***

                  ***************************

                  *****

                  'Get the command line arguments For i = 0 to Wscript.arguments.count - 1 ReDim Preserve arrArguments(i) arrArguments(i) = Wscript.arguments.item(i) Next

                  'Check whether the script is run using CScript Select Case intChkProgram() Case CONST_CSCRIPT 'Do Nothing Case CONST_WSCRIPT WScript.Echo "Please run this script using CScript." & vbCRLF & _ "This can be achieved by" & vbCRLF & _ "1. Using ""CScript MODIFYUSERS.vbs arguments"" for Windows 95/98 or" & VbCrLf & _ "2. Changing the default Windows Scripting Host setting to CScript" & vbCRLF & _ " using ""CScript //H:CScript //S"" and running the script using" & vbCRLF & _ " ""MODIFYUSERS.vbs arguments"" for Windows NT." WScript.Quit Case Else WScript.Quit End Select

                  'Parse the command line Err.Clear() intOpMode = intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage)

                  If Err.Number Then Wscript.Echo "Error 0X" & CStr(Hex(Err.Number)) & " occurred in parsing the command line." If Err.Description <> "" Then Wscript.Echo "Error description: " & Err.Description & "." End If 'WScript.quit End If

                  Select Case intOpMode Case CONST_SHOW_USAGE Call ShowUsage() WScript.quit Case CONST_PROCEED 'Do nothing. Case CONST_ERROR WScript.quit Case Else Wscript.Echo "Error occurred in passing parameters." End Select

                  '*********

                  *********************
                  ********
                  '* Main Script '**************************************

                  WScript.Echo strOptionsMessage

                  blnPinned = PinItem(strPath, blnTaskbar) WScript.Echo "Item pinned: " & CStr(blnPinned)

                    If blnPinned Then WScript.Quit(0) Else WScript.Quit(1) End If

                    '*********

                    *********
                    ********************
                    '* '* Function intChkProgram() '* '* Purpose: Determines which program is used to run this script. '* '* Input: None '* '* Returns: intChkProgram is set to one of CONST_ERROR, CONST_WSCRIPT, '* and CONST_CSCRIPT. '* '*********************

                    *****************

                    Private Function intChkProgram()

                    ON ERROR RESUME NEXT
                    
                    Dim i
                    Dim j
                    Dim strFullName
                    Dim strCommand
                    
                    'strFullName should be something like C:\WINDOWS\COMMAND\CSCRIPT.EXE
                    strFullName = WScript.FullName
                    If Err.Number then
                        Wscript.Echo "Error 0x" & CStr(Hex(Err.Number)) & " occurred."
                        If Err.Description <> "" Then
                            Wscript.Echo "Error description: " & Err.Description & "."
                        End If
                        intChkProgram =  CONST_ERROR
                        Exit Function
                    End If
                    
                    i = InStr(1, strFullName, ".exe", 1)
                    If i = 0 Then
                        intChkProgram =  CONST_ERROR
                        Exit Function
                    Else
                        j = InStrRev(strFullName, "\", i, 1)
                        If j = 0 Then
                            intChkProgram =  CONST_ERROR
                            Exit Function
                        Else
                            strCommand = Mid(strFullName, j+1, i-j-1)
                            Select Case LCase(strCommand)
                                Case "cscript"
                                    intChkProgram = CONST_CSCRIPT
                                Case "wscript"
                                    intChkProgram = CONST_WSCRIPT
                                Case Else       'should never happen
                                    Wscript.Echo "An unexpected program is used to run this script."
                                    Wscript.Echo "Only CScript.Exe or WScript.Exe can be used to run this script."
                                    intChkProgram = CONST_ERROR
                            End Select
                        End If
                    End If
                    

                    End Function

                    '***

                      *********************
                        ************
                          **
                          '* '* Function intParseCmdLine() '* '* Purpose: Parses the command line. '* '* Input: arrArguments An array containing input from the command line '* '* Input: strPath Path of exe to pin '* strOptionsMessage String containing options selected '* '* Returns: intParseCmdLine is set to one of CONST_ERROR, CONST_SHOW_USAGE, '* and CONST_PROCEED. '* '************************

                          **************
                          Private Function intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage)

                            ON ERROR RESUME NEXT
                            
                            Dim i
                            Dim strFlag
                            Dim strSwitchValue
                            
                            strFlag = arrArguments(0)
                            Err.Clear()
                            
                            'Help is needed
                            If (strFlag = "") OR (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
                                OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") OR (strFlag="h") Then
                                intParseCmdLine = CONST_SHOW_USAGE
                                Exit Function
                            End If
                            
                            strOptionsMessage = strOptionsMessage & ""  & VbCrLf
                            strOptionsMessage = strOptionsMessage & WScript.ScriptName  & VbCrLf
                            strOptionsMessage = strOptionsMessage & ""  & VbCrLf
                            strOptionsMessage = strOptionsMessage & "Command Line Options:"  & vbCrLf
                            strOptionsMessage = strOptionsMessage & "======================================="  & VbCrLf
                            
                            For i = 0 to UBound(arrArguments)
                                strFlag = Left(arrArguments(i), InStr(1, arrArguments(i), ":")-1)
                                If Err.Number Then            'An error occurs if there is no : in the string
                                    Err.Clear
                                    Select Case LCase(arrArguments(i))
                                        Case "/q"
                                            blnQuiet = True
                                            strOptionsMessage = strOptionsMessage & "Supress Console Output: " & blnQuiet & VbCrLf
                                        Case "/taskbar"
                                            blnTaskbar = True
                                            strOptionsMessage = strOptionsMessage & "Pin to Taskbar instead of Start Menu: " & blnTaskbar & VbCrLf
                                        Case Else
                                            Wscript.Echo arrArguments(i) & " is not recognized as a valid input."
                                            intParseCmdLine = CONST_ERROR
                                            Exit Function
                                    End Select
                                Else
                                    strSwitchValue = Right(arrArguments(i), Len(arrArguments(i))-(Len(strFlag)+1))
                                    Select Case LCase(strFlag)
                                        Case "/item"
                                            strPath = strSwitchValue
                                            strOptionsMessage = strOptionsMessage & "Item to pin to Start Menu or Taskbar: " & strPath & VbCrLf
                                        Case else
                                            Wscript.Echo "Invalid flag " & strFlag & "."
                                            Wscript.Echo "Please check the input and try again."
                                            intParseCmdLine = CONST_ERROR
                                            Exit Function
                                    End Select
                                End If
                            Next
                            
                            If (strPath = "") Then
                                Wscript.Echo "The /item switch is required"
                                Wscript.Echo "Please check the input and try again."
                                intParseCmdLine = CONST_ERROR
                                Exit Function
                            End If
                            
                            intParseCmdLine = CONST_PROCEED
                            

                            End Function

                            '******

                            ******************************

                            **
                            '* '* Function PinItem() '* '* Purpose: Pin item to the Start Menu. '* '* Input: strlPath Path of exe to pin '* blnTaskbar Pin item to Taskbar instead of Start Menu if true '* '* Dependencies: objShell Shell.Application object '* objFSO File System object '* '* Returns: True if the shortcut is created, else false '* '***************************

                            ***********
                            Function PinItem(strlPath, blnTaskbar) On Error Resume Next

                            Dim colVerbs
                            Dim itemverb
                            
                            Dim objFolder
                            Dim objFolderItem
                            
                            Dim strFolder
                            Dim strFile
                            
                            If objFSO.FileExists(strlPath) Then
                                '***** Do nothing, folder exists
                            Else
                                '***** Folder does not exist
                                PinItem = False
                                WScript.Echo "File to pin does not exist."
                                WScript.Echo "Please check the input and try again."
                                Exit Function
                            End If
                            
                            strFolder = objFSO.GetParentFolderName(strlPath)
                            strFile = objFSO.GetFileName(strlPath)
                            
                            WScript.Echo "Folder: " & strFolder
                            WScript.Echo "File: " & strFile
                            
                            Err.Clear
                            Set objFolder = objShell.Namespace(strFolder)
                            Set objFolderItem = objFolder.ParseName(strFile)
                            
                            ' ***** InvokeVerb for this does not work on Vista/WS2008
                            'objFolderItem.InvokeVerb("P&in to Start Menu")
                            
                            ' ***** This code works on Vista/WS2008
                            Set colVerbs = objFolderItem.Verbs
                            
                            If blnTaskbar Then
                                For each itemverb in objFolderItem.verbs
                                    If Replace(itemverb.name, "&", "") = "Pin to Taskbar" Then itemverb.DoIt
                                Next 
                            Else
                                For each itemverb in objFolderItem.verbs
                                    If Replace(itemverb.name, "&", "") = "Pin to Start Menu" Then itemverb.DoIt
                                Next 
                            End If
                            
                            If Err.Number = 0 Then
                                PinItem = True
                            Else
                                PinItem = False
                            End If
                            

                            End Function

                            '***

                              *********
                              *********************
                                ***
                                  **
                                  '* '* Sub ShowUsage() '* '* Purpose: Shows the correct usage to the user. '* '* Input: None '* '* Output: Help messages are displayed on screen. '* '***************************
                                  ***********
                                  Sub ShowUsage() WScript.Echo "This script is used to Pin items to the Start Menu or Taskbar." WScript.Echo "" WScript.Echo "Usage: cscript " & WScript.ScriptName & " [options]" WScript.Echo "" WScript.Echo "Options:" WScript.Echo "" WScript.Echo " /item: Path of item to pin." WScript.Echo "" WScript.Echo " /taskbar (Optional) Pin to Taskbar instead of Start Menu." WScript.Echo "" WScript.Echo " /? (Optional) Displays this help text." WScript.Echo "" WScript.Echo "" WScript.Echo "" End Sub

                                • Two methods spring to mind:

                                  1. Windows logon script
                                  2. Miscrosoft Systems Management Server
                                • Fair enough. I did download ProcesMonitor, set it to capture events just before closing NUnit, and began watching it. When the NUnit window disappeared from the screen I went to ProcessMonitor to see what happened. ProcessMonitor locked up. – Mike Chess Feb 4 '10 at 19:23

                                • Found this script recently appears to work when run locally, I'm new to sccm2007 having problems deploying script from Task Sequence.

                                  ' Windows Script Host Sample Script ' ' ------------------------------------------------------------------------ ' Copyright (C) 2009 Microsoft Corporation ' ' You have a royalty-free right to use, modify, reproduce and distribute ' the Sample Application Files (and/or any modified version) in any way ' you find useful, provided that you agree that Microsoft and the author ' have no warranty, obligations or liability for any Sample Application Files. ' ------------------------------------------------------------------------

                                    '******

                                      ******
                                      ******

                                      ******************
                                      **
                                      '* '* File: PinItem.vbs '* Date: 03/04/2009 '* Version: 1.0.2 '* '* Main Function: VBScipt to pin an item to the Start Menu or Taskbar '* '* Usage: cscript PinItem.vbs /item: '* [/taskbar] [/?] '* '* Copyright (C) 2009 Microsoft Corporation '* '* Revisions: '* '* 1.0.0 - 04/03/2008 - Created. '* 1.0.1 - 03/02/2009 - Used Replace in PinItem function to remove "&" '* from verb. '* 1.0.2 - 03/04/2009 - Script name was PinToStartMenu.vbs. Added '* /taskbar switch to pin items to taskbar on '* Win7. '* '*********

                                      ******************

                                      ***********

                                      '******************

                                      ************

                                      *************
                                      '* Declare Variables '******
                                        ***

                                        ***
                                        *******************************

                                        Option Explicit 'On Error Resume Next

                                        Dim blnPinned Dim blnTaskbar

                                        Dim i Dim intOpMode

                                        Dim objWshShell Dim objFSO Dim objShell

                                        Dim strPath Dim strArguments Dim strOptionsMessage

                                        ' Define constants Const CONST_ERROR = 0 Const CONST_WSCRIPT = 1 Const CONST_CSCRIPT = 2 Const CONST_SHOW_USAGE = 3 Const CONST_PROCEED = 4 Const CONST_STRING_NOT_FOUND = -1 Const CONST_FOR_READING = 1 Const CONST_FOR_WRITING = 2 Const CONST_FOR_APPENDING = 8 Const CONST_Success = 0 Const CONST_Failure = 1

                                        Const TRISTATE_USE_DEFAULT = -2 Const TRISTATE_TRUE = -1 'Open the file as Unicode. Const TRISTATE_FALSE = 0 'Open the file as ASCII.

                                        blnTaskbar = False

                                        '***

                                          ***************************

                                          *************
                                          '* Create Objects '************************************

                                          ******
                                            *

                                            Set objWshShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application")

                                            '******************************

                                            ******
                                              **
                                              '* Check script host exe and parse command line '************************

                                              ***

                                              ***********

                                              'Get the command line arguments For i = 0 to Wscript.arguments.count - 1 ReDim Preserve arrArguments(i) arrArguments(i) = Wscript.arguments.item(i) Next

                                              'Check whether the script is run using CScript Select Case intChkProgram() Case CONST_CSCRIPT 'Do Nothing Case CONST_WSCRIPT WScript.Echo "Please run this script using CScript." & vbCRLF & _ "This can be achieved by" & vbCRLF & _ "1. Using ""CScript MODIFYUSERS.vbs arguments"" for Windows 95/98 or" & VbCrLf & _ "2. Changing the default Windows Scripting Host setting to CScript" & vbCRLF & _ " using ""CScript //H:CScript //S"" and running the script using" & vbCRLF & _ " ""MODIFYUSERS.vbs arguments"" for Windows NT." WScript.Quit Case Else WScript.Quit End Select

                                              'Parse the command line Err.Clear() intOpMode = intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage)

                                                If Err.Number Then Wscript.Echo "Error 0X" & CStr(Hex(Err.Number)) & " occurred in parsing the command line." If Err.Description <> "" Then Wscript.Echo "Error description: " & Err.Description & "." End If 'WScript.quit End If

                                                Select Case intOpMode Case CONST_SHOW_USAGE Call ShowUsage() WScript.quit Case CONST_PROCEED 'Do nothing. Case CONST_ERROR WScript.quit Case Else Wscript.Echo "Error occurred in passing parameters." End Select

                                                '******

                                                ******

                                                ***
                                                ******************
                                                  *****
                                                    '* Main Script '***
                                                    ******************
                                                    ************

                                                    *****

                                                    WScript.Echo strOptionsMessage

                                                    blnPinned = PinItem(strPath, blnTaskbar) WScript.Echo "Item pinned: " & CStr(blnPinned)

                                                    If blnPinned Then WScript.Quit(0) Else WScript.Quit(1) End If

                                                    '******

                                                    *********************
                                                    ***********
                                                    '* '* Function intChkProgram() '* '* Purpose: Determines which program is used to run this script. '* '* Input: None '* '* Returns: intChkProgram is set to one of CONST_ERROR, CONST_WSCRIPT, '* and CONST_CSCRIPT. '* '***************************

                                                    *********

                                                    **
                                                      Private Function intChkProgram()

                                                      ON ERROR RESUME NEXT
                                                      
                                                      Dim i
                                                      Dim j
                                                      Dim strFullName
                                                      Dim strCommand
                                                      
                                                      'strFullName should be something like C:\WINDOWS\COMMAND\CSCRIPT.EXE
                                                      strFullName = WScript.FullName
                                                      If Err.Number then
                                                          Wscript.Echo "Error 0x" & CStr(Hex(Err.Number)) & " occurred."
                                                          If Err.Description <> "" Then
                                                              Wscript.Echo "Error description: " & Err.Description & "."
                                                          End If
                                                          intChkProgram =  CONST_ERROR
                                                          Exit Function
                                                      End If
                                                      
                                                      i = InStr(1, strFullName, ".exe", 1)
                                                      If i = 0 Then
                                                          intChkProgram =  CONST_ERROR
                                                          Exit Function
                                                      Else
                                                          j = InStrRev(strFullName, "\", i, 1)
                                                          If j = 0 Then
                                                              intChkProgram =  CONST_ERROR
                                                              Exit Function
                                                          Else
                                                              strCommand = Mid(strFullName, j+1, i-j-1)
                                                              Select Case LCase(strCommand)
                                                                  Case "cscript"
                                                                      intChkProgram = CONST_CSCRIPT
                                                                  Case "wscript"
                                                                      intChkProgram = CONST_WSCRIPT
                                                                  Case Else       'should never happen
                                                                      Wscript.Echo "An unexpected program is used to run this script."
                                                                      Wscript.Echo "Only CScript.Exe or WScript.Exe can be used to run this script."
                                                                      intChkProgram = CONST_ERROR
                                                              End Select
                                                          End If
                                                      End If
                                                      

                                                      End Function

                                                      '***

                                                        ******
                                                        ******

                                                        ***********************
                                                        '* '* Function intParseCmdLine() '* '* Purpose: Parses the command line. '* '* Input: arrArguments An array containing input from the command line '* '* Input: strPath Path of exe to pin '* strOptionsMessage String containing options selected '* '* Returns: intParseCmdLine is set to one of CONST_ERROR, CONST_SHOW_USAGE, '* and CONST_PROCEED. '* '************

                                                        *********
                                                        ************

                                                        *****
                                                        Private Function intParseCmdLine(arrArguments, strPath, blnTaskbar, strOptionsMessage)

                                                        ON ERROR RESUME NEXT
                                                        
                                                        Dim i
                                                        Dim strFlag
                                                        Dim strSwitchValue
                                                        
                                                        strFlag = arrArguments(0)
                                                        Err.Clear()
                                                        
                                                        'Help is needed
                                                        If (strFlag = "") OR (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
                                                            OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") OR (strFlag="h") Then
                                                            intParseCmdLine = CONST_SHOW_USAGE
                                                            Exit Function
                                                        End If
                                                        
                                                        strOptionsMessage = strOptionsMessage & ""  & VbCrLf
                                                        strOptionsMessage = strOptionsMessage & WScript.ScriptName  & VbCrLf
                                                        strOptionsMessage = strOptionsMessage & ""  & VbCrLf
                                                        strOptionsMessage = strOptionsMessage & "Command Line Options:"  & vbCrLf
                                                        strOptionsMessage = strOptionsMessage & "======================================="  & VbCrLf
                                                        
                                                        For i = 0 to UBound(arrArguments)
                                                            strFlag = Left(arrArguments(i), InStr(1, arrArguments(i), ":")-1)
                                                            If Err.Number Then            'An error occurs if there is no : in the string
                                                                Err.Clear
                                                                Select Case LCase(arrArguments(i))
                                                                    Case "/q"
                                                                        blnQuiet = True
                                                                        strOptionsMessage = strOptionsMessage & "Supress Console Output: " & blnQuiet & VbCrLf
                                                                    Case "/taskbar"
                                                                        blnTaskbar = True
                                                                        strOptionsMessage = strOptionsMessage & "Pin to Taskbar instead of Start Menu: " & blnTaskbar & VbCrLf
                                                                    Case Else
                                                                        Wscript.Echo arrArguments(i) & " is not recognized as a valid input."
                                                                        intParseCmdLine = CONST_ERROR
                                                                        Exit Function
                                                                End Select
                                                            Else
                                                                strSwitchValue = Right(arrArguments(i), Len(arrArguments(i))-(Len(strFlag)+1))
                                                                Select Case LCase(strFlag)
                                                                    Case "/item"
                                                                        strPath = strSwitchValue
                                                                        strOptionsMessage = strOptionsMessage & "Item to pin to Start Menu or Taskbar: " & strPath & VbCrLf
                                                                    Case else
                                                                        Wscript.Echo "Invalid flag " & strFlag & "."
                                                                        Wscript.Echo "Please check the input and try again."
                                                                        intParseCmdLine = CONST_ERROR
                                                                        Exit Function
                                                                End Select
                                                            End If
                                                        Next
                                                        
                                                        If (strPath = "") Then
                                                            Wscript.Echo "The /item switch is required"
                                                            Wscript.Echo "Please check the input and try again."
                                                            intParseCmdLine = CONST_ERROR
                                                            Exit Function
                                                        End If
                                                        
                                                        intParseCmdLine = CONST_PROCEED
                                                        

                                                          End Function

                                                          '************************************** '* '* Function PinItem() '* '* Purpose: Pin item to the Start Menu. '* '* Input: strlPath Path of exe to pin '* blnTaskbar Pin item to Taskbar instead of Start Menu if true '* '* Dependencies: objShell Shell.Application object '* objFSO File System object '* '* Returns: True if the shortcut is created, else false '* '*********************

                                                            ***************** Function PinItem(strlPath, blnTaskbar) On Error Resume Next

                                                            Dim colVerbs
                                                            Dim itemverb
                                                            
                                                            Dim objFolder
                                                            Dim objFolderItem
                                                            
                                                            Dim strFolder
                                                            Dim strFile
                                                            
                                                            If objFSO.FileExists(strlPath) Then
                                                                '***** Do nothing, folder exists
                                                            Else
                                                                '***** Folder does not exist
                                                                PinItem = False
                                                                WScript.Echo "File to pin does not exist."
                                                                WScript.Echo "Please check the input and try again."
                                                                Exit Function
                                                            End If
                                                            
                                                            strFolder = objFSO.GetParentFolderName(strlPath)
                                                            strFile = objFSO.GetFileName(strlPath)
                                                            
                                                            WScript.Echo "Folder: " & strFolder
                                                            WScript.Echo "File: " & strFile
                                                            
                                                            Err.Clear
                                                            Set objFolder = objShell.Namespace(strFolder)
                                                            Set objFolderItem = objFolder.ParseName(strFile)
                                                            
                                                            ' ***** InvokeVerb for this does not work on Vista/WS2008
                                                            'objFolderItem.InvokeVerb("P&in to Start Menu")
                                                            
                                                            ' ***** This code works on Vista/WS2008
                                                            Set colVerbs = objFolderItem.Verbs
                                                            
                                                            If blnTaskbar Then
                                                                For each itemverb in objFolderItem.verbs
                                                                    If Replace(itemverb.name, "&", "") = "Pin to Taskbar" Then itemverb.DoIt
                                                                Next 
                                                            Else
                                                                For each itemverb in objFolderItem.verbs
                                                                    If Replace(itemverb.name, "&", "") = "Pin to Start Menu" Then itemverb.DoIt
                                                                Next 
                                                            End If
                                                            
                                                            If Err.Number = 0 Then
                                                                PinItem = True
                                                            Else
                                                                PinItem = False
                                                            End If
                                                            

                                                            End Function

                                                            '************************************** '* '* Sub ShowUsage() '* '* Purpose: Shows the correct usage to the user. '* '* Input: None '* '* Output: Help messages are displayed on screen. '* '*********

                                                              ***************************** Sub ShowUsage() WScript.Echo "This script is used to Pin items to the Start Menu or Taskbar." WScript.Echo "" WScript.Echo "Usage: cscript " & WScript.ScriptName & " [options]" WScript.Echo "" WScript.Echo "Options:" WScript.Echo "" WScript.Echo " /item: Path of item to pin." WScript.Echo "" WScript.Echo " /taskbar (Optional) Pin to Taskbar instead of Start Menu." WScript.Echo "" WScript.Echo " /? (Optional) Displays this help text." WScript.Echo "" WScript.Echo "" WScript.Echo "" End Sub

                                                            • Any luck with Win + R to bring up Run, then if so try to launch "taskmgr" that way.

                                                              If you have a working explorer window, use "C:\WINDOWS\system32\taskmgr.exe"

                                                              but outside of these two options, Right Click -> Task Manager, CTRL+ALT+DEL and CTRL+SHIFT+ESC you can't do much more.

                                                            • You misunderstood Mathieu's suggestion. You used Process Explorer, which is a great tool, but he had suggested that you use Process Monitor (also from Sysinternals), which will give you much more granular information and you may find out what in the code is locking you up. – mfinni Feb 4 '10 at 18:51

                                                            • I haven't tried Win+R in this context. The shell has been unresponsive, so I would expect that it wouldn't work either. I'll endeavor to try it as I work through this. – Mike Chess Feb 4 '10 at 18:25

                                                            • This might be overkill, but if you're comfortable with kernel dumps you can force a blue screen memory dump from the keyboard and then look at the memory dump file...

                                                            • You assume that all 100 systems are on in this case. The OP would probably be better off making a login script with some logic in it to check for an existing install. – MDMarra Oct 12 '11 at 17:49

                                                            • I wish this was easier, as Group Policy is probably the most ideal method. Unfortunately, it's rather difficult to find any decent msi-building tools that let you build them quickly and visually. – Cypher May 25 '11 at 23:35

                                                              • you could use ctrl + shift +esc

                                                                but i guess it won't work better, as even the sas sequence is not working.

                                                                  You could either use process monitor from sysinternal (launched before the hand) or enable the crashOnControl to get a memory dump and so find what's hanging the system that way

                                                                • +1 for Systems Management Server and other mass-deployment-management software in that vein – voretaq7 ♦ May 25 '11 at 22:01

                                                                  • @jscott: i found wininstall le (and most other msi packagers) to be all but useless to those who haven't memorized the .msi db structure. having a gui is not what i meant by visual; taking a standard setup.exe and converting to .msi by simply walking through the normal install prompts and checking off a few options along the way would be my idea of a 'quick and visual' procedure. haven't tried adv. installer - it looked more like a packaging system for software developers. i'll give it another look. – Cypher May 26 '11 at 1:43

                                                                  • I would build an MSI file and deploy it via Group Policy.

                                                                  • some software programs have .msi packages available, and those that do will make deployment via group policy a snap: support.microsoft.com/kb/816102 . – Cypher May 26 '11 at 1:46

                                                                  • Although you can put it in the login script, you may have to add logic to check for existence, so it does not install multiple times.

                                                                    You could use this free tool (PS.EXE) from Sysinternals, now Microsoft, to run the setup file on remote systems without actually logging into them, or installing any client software. I would setup a network install point for googletalk-setup.exe then use the utility. It even can install to multiple systems, or an entire domain using a wildcard.

                                                                    http://technet.microsoft.com/en-us/sysinternals/bb897553 http://www.windowsitpro.com/article/remote-computing/psexec (utility was renamed, but usage is the same)

                                                                  • I assume by VBS you're referring to this post.

                                                                    The post also mentions the ability to add a max of 3 shortcuts to the 'superbar' via unattend.xml, which you can modify in the Deployment Workbench and DISM.

                                                                    The other alternative is to create the profile with all the 'superbar' icons set as you want, and make this the default profile. The assumes all the apps you want in the superbar will be installed on the desktop at deployment time, and that you want the same for all users on the machine. It also assumes that the default profile is derived from the one on the machine, and not from another location (a GPO setting). This needs to be done before the capture phase, so it will be deployed to all machines (alternatively, you can deploy the default profile manually during the deployment phase).

                                                                    We used this method to remove the Windows PowerShell and Server Manager icons that come default on Windows Server 2008 for our Remote Desktop users.

                                                                  • psexec is a certainly a good tool, but does not handle multiple choices when an installer has no or few command line options (when installer is close to entirely GUI).

                                                                    I've seen a working kixtart script as the logon script. It is used to load and launch other scripts according to the install sequence which may be as follows:

                                                                    "logon" script executes at login. Launches "mount" script to mount apps drive. Launches "updater" script that looks for apps.

                                                                    "updater" script launches "transfer" script that transfers apps to local directory. "updater" then launches "install" script (unique for each app)

                                                                      "install" script may be any method... batch, AutoIT, psexec.. whichever works, preferably silent and fast

                                                                      "updater" logs to directory in apps drive "logon" script logs to directory in apps drive

                                                                      All of this can be done on a shoestring budget, but there is a very steep learning curve. I know that updating at login is a great way to slow down login. "updater" could be installed as a Scheduled Task on login and run at a more appropriate time.

                                                                      By the way, does anyone have any kixtart script samples to help him out?

                                                                    • +1 Note that Systems Management Server (SMS) is now called System Center Configuration Manager (SCCM) microsoft.com/systemcenter/en/us/configuration-manager/… – GAThrawn Jun 10 '11 at 17:22

                                                                    • That is a shame :( options are limited after that. Really not much more you can do beyond the methods I listed above. – Urda Feb 4 '10 at 21:16

                                                                      • I assume by VBS you're referring to this post.

                                                                        The post also mentions the ability to add a max of 3 shortcuts to the 'superbar' via unattend.xml, which you can modify in the Deployment Workbench and DISM.

                                                                        The other alternative is to create the profile with all the 'superbar' icons set as you want, and make this the default profile. The assumes all the apps you want in the superbar will be installed on the desktop at deployment time, and that you want the same for all users on the machine. It also assumes that the default profile is derived from the one on the machine, and not from another location (a GPO setting). This needs to be done before the capture phase, so it will be deployed to all machines (alternatively, you can deploy the default profile manually during the deployment phase).

                                                                        We used this method to remove the Windows PowerShell and Server Manager icons that come default on Windows Server 2008 for our Remote Desktop users.

                                                                          • @Cypher Really? Advanced Installer , WinInstall LE are [just] two free, GUI apps which make MSI packaging incredibly simple. – jscott May 26 '11 at 1:13