Copy Taskbar Icons Windows 7 Sysprep v2


Sysprep – Copy Taskbar Icons

Ok, you can thank a colleague of mine (Dinyero Johnson) for this new single vbs script that now copies the taskbar icons and deletes itself.

The vbs script is a little nicer than version one (CMD) because it runs without any windows and in my opinion vbs scripts just run smoother :). Also, it is a single file and the tutorial has less steps.

So for all of you who grabbed version one, lol, grab version 2!!! And if you are using WIM images, you can simply mount your image, replace the script, and unmount/commit.

Repeat instructions are below:

When running sysprep in Windows 7 with the unattend.xml file, you will probably notice that the taskbar icons are something that don’t copy over. Well that is because the icons are not part of the users profile. So the copyprofile=true command does work for almost everything, but it doesn’t copy over your taskbar icons. So here is a script that will do it for you.

Step 1

Download the vbs script.
You might have to remove the .txt extension when you are downloading the script. You are going to drop this script into the correct place during audit mode.

[vb]
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

‘ – Remove pinned items –

‘Internet Explorer
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next
End If

‘Windows Explorer
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next
End If
‘Windows Media Player
If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next
End If

‘ – Pin to Taskbar –

‘Windows Explorer
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Windows Explorer.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
Set objFolderItem = objFolder.ParseName("Windows Explorer.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Internet Explorer
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs")
Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Mozilla Firefox
If objFSO.FileExists(strAllUsersProgramsPath & "\Mozilla Firefox\Mozilla Firefox.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Mozilla Firefox")
Set objFolderItem = objFolder.ParseName("Mozilla Firefox.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Microsoft Word 2010
If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Word 2010.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
Set objFolderItem = objFolder.ParseName("Microsoft Word 2010.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Microsoft Excel 2010
If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Excel 2010.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
Set objFolderItem = objFolder.ParseName("Microsoft Excel 2010.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Microsoft Outlook 2010
If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office\Microsoft Outlook 2010.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
Set objFolderItem = objFolder.ParseName("Microsoft Outlook 2010.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Windows Media Player
If objFSO.FileExists(strAllUsersProgramsPath & "\Windows Media Player.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
Set objFolderItem = objFolder.ParseName("Windows Media Player.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If

‘Delete the script
DeleteSelf

Sub DeleteSelf()
Dim objFSO
‘Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
‘Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing
End Sub

[/vb]

Step 2

Copy the vbs script into the startup folder in the start menu.

Step 3

The vbs script unpins WMP, IE, and Windows Explorer and then repins the icons in the order you want. My file has this order:

[vb]Windows Explorer, IE, Firefox, Word, Excel, Outlook, WMP[/vb]

Step 4

Now run sysprep as you normally would and the script is copied into the default profile. That means for every new user, the script pins the icons in the order you want, the script then deletes itself and never runs again. For the correct procedure on sysprepping your machine, read my Windows 7 Sysprep Tutorial.

You may also like:

Sysprep a Windows 7 Machine – Start to Finish V2 This is version 2 of a step by step guide on Sysprepping a Windows 7 machine from start to finish. I cannot take full credit on this because my first ...
Copy Taskbar Icons Windows 7 Sysprep This is the old version, please see the new Copy Taskbar Icons Windows 7 Sysprep v2. Ok, you can thank a colleague of mine (Dinyero Johnson) for th...
Comments
  1. Posted by Nathan Symington
  2. Posted by guest
    • Posted by Brian Jackson
  3. Posted by Guest
  4. Posted by Doug
  5. Posted by Doug
    • Posted by Name
  6. Posted by adriankeith
  7. Posted by Jesse Armbruster
  8. Posted by Wyko ter Haar
    • Posted by Brian Jackson
      • Posted by Wyko ter Haar
  9. Posted by layer8pro
    • Posted by Brian Jackson
  10. Posted by Stu
    • Posted by rtp1621
      • Posted by Moulay Ahmed A Rahhali
  11. Posted by Ca Po
  12. Posted by Mike5314
  13. Posted by Mike
  14. Posted by Clement Bowman
  15. Posted by Headworx
  16. Posted by University_Deck
  17. Posted by Markus
  18. Posted by Jason Watkins

Add Your Comment