Copy Taskbar Icons Windows 7 Sysprep v2

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 (11kb). Click Here to Download or Right Click and Save Target As….
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.

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:

Windows Explorer, IE, Firefox, Word, Excel, Outlook, WMP

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.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • Google Bookmarks

Tags: , , ,

31 Responses to “Copy Taskbar Icons Windows 7 Sysprep v2”

  1. [...] « Rapid Recovery from RSI after 10 months of Chronic Pain Copy Taskbar Icons Windows 7 Sysprep v2 [...]

  2. Matthew says:

    Why is the code duplicated? It appears at least in the file I downloaded that starting on line 127, the script repeats itself.

  3. That was my bad, I have fixed it and re-uploaded the script. It should work fine now without that extra code. Enjoy!

  4. Jason says:

    What about quick launch will this work with that or do you have a way to keep the quick launch toolbar for every user?

  5. bkz81 says:

    I just tired this and WOW this is great! I do have a question though. I would like to take out Outlook, and insert the FLIP 3D location, and put in Lotus Notes 8.5. Not too familar with scripts how can i go about adding those two in there? thanks.

  6. Mark Vogt says:

    Brian, this is a great script. I only have one issue… We are deploying Win7 64bit. This script does not seem syntax for 64 bit. The Windows explorer and IE8 shortcuts are pinned, but the Office applications are not. Any help would be great.

  7. Liam says:

    Fantastci script, thanks for this. One problem though, this script runs for every user when they FIRST log on, any reason for this?

    Thanks

  8. Jason says:

    so does anyone know how to get this so that the quick launch stays with every user instead of the taskbar?

  9. Luke says:

    Thank you for this script

    @Liam
    That’s the idea behind it! It should copy allways the files to the new and first time logged on user!

    @Brian
    This script has no CR & LF so it’s hard to read so!! Maybe you can change thist

    Lukacs

  10. Kim A says:

    I just downloaded the VB script 3 different times on different and each time the file has no line breaks. It is one continuous line when viewing it in Notepad. Anybody else see this problem or is it just me?

  11. Jason F says:

    I would like to know how to make the quick launch bar stay with every user as well.

  12. Paul says:

    Great script but i am having a problem getting it to run properly. The script seems to run whenever a new user firsts logs (all icons get removed and start to go back on again i.e Explorer, IE, WMP but it doesnt pin my office links onto the taskbar.

    But if i run SetTaskbar.vbs from my mem stick it adds all the icons i want.

    Anyone have any ideas?

  13. Gill Bates says:

    excellent trick, thank you so much! now i just need to find out how i can have it prompt for a computer name then join the domain successfully after sysprep. only seems to work if i assign a name in my xml but i need to be able to create one based on the user the machine is going to.

  14. Frank says:

    Thank you for the script, really useful!
    Took me about an hour of fiddling with it to make it work on a french OS (Pin and unpin command are different)

    I was also able to add a shortcut for Lotus notes by adding a new section

    bkz81: you can modify the script and add a new section that looks like this (I had to modify it in MS Word):
    ‘Lotus Notes
    If objFSO.FileExists(strAllUsersProgramsPath & “\Lotus Application\Lotus Notes 8.5.lnk”) Then
    Set objFolder = objShell.Namespace(strAllUsersProgramsPath & “\Lotus Application”)
    Set objFolderItem = objFolder.ParseName(“Lotus Notes 8.5.lnk”)
    Set colVerbs = objFolderItem.Verbs
    For Each objVerb in colVerbs
    If Replace(objVerb.name, “&”, “”) = “Pin to Taskbar” Then objVerb.DoIt
    Next
    End If

    Lotus Application = The name of the folder in the Start menu
    Lotus notes 8.5.lnk = The name of the shortcut in the above folder

    Liam: I think the reason it is run by every user is that the quick launch isn’t copied over to the default user… so it has to be run for every user on their first logon if you want to have the right shortcuts.
    Also, I have not found a “all user” folder either in Windows 7, so it cannot be put there.

  15. Fred says:

    Very nice script! I do believe we will be deploying Windows 7 in our environment in the near future with this. One thing, though..

    I tried modifying your script to pin Office 2007 shortcuts (Word, Excel, PowerPoint) and a GroupWise (don’t ask…) shortcut to the taskbar.

    The shortcut for the office apps is:
    %allusersprofile%\microsoft\windows\start menu\programs\microsoft office\microsoft office ____ 2007.lnk

    GroupWise is:
    %allusersprofile%\microsoft\windows\start menu\programs\Novell GroupWise\GroupWise.lnk

    Here is what I did to the script. Tell me if this is right or wrong (keep in mind it’s not working for me when I execute it):

    If objFSO.FileExists(strCurrentUserStartFolderPath & “\Programs\Microsoft Office\Microsoft Office Word 2007.lnk”) Then
    Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & “\Programs\Microsoft Office”)
    Set objFolderItem = objFolder.ParseName(“Microsoft Office Word 2007.lnk”)
    Set colVerbs = objFolderItem.Verbs
    For Each objVerb in colVerbs
    If Replace(objVerb.name, “&”, “”) = “Pin to Taskbar” Then objVerb.DoIt
    Next
    End If

  16. Fred says:

    Ah, nevermind, I was able to do it. I changed “strCurrentUserStartFolderPath” to “strAllUsersProgramsPath” and changed a couple other things and it seemed to work.

    What’s the difference between the two?

  17. Frank says:

    “strCurrentUserStartFolderPath” = C:\Users\nameofaccount\AppData\Roaming\Microsoft\Windows\Start Menu
    “strAllUsersProgramsPath” = C:\ProgramData\Microsoft\Windows\Start Menu\Programs

    You can modify the script to output those information to the screen.
    Before the Remove Pinned items section, you just have to enter this:
    Wscript.Echo strCurrentUserStartFolderPath
    Wscript.Echo strAllUsersProgramsPath

    You can use the “Wscript.Echo” with any variables to find out their value. I usually place that right after a variable has been set.

  18. Chet says:

    I have a customized start menu with folders that I pinned from the desktop for lab use. “Class Applications, Internet Applications, Multimedia Applications” with Microsoft Office in Class Apps, IE & Firefox in Internet Apps. Only Accesories and Startup in All Programs. I have tried changing the script to match… see example. Any help? I don’t know VB.

    ‘Windows Media Player
    If objFSO.FileExists(strCurrentUserStartFolderPath & “\Multimedia Applications\Windows Media Player.lnk”) Then
    Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & “\Multimedia Applications”)
    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 -

    ‘Internet Explorer
    If objFSO.FileExists(strCurrentUserStartFolderPath & “\Internet Applications\Internet Explorer.lnk”) Then
    Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & “\Internet Applications”)
    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(strCurrentUserStartFolderPath & “\Internet Applications\Mozilla Firefox\Mozilla Firefox.lnk”) Then
    Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & “\Internet Applications\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

  19. Nick Brown says:

    Yeah, I’ve noticed that to. Unable to get office (word, excel, outlook) to pin with windows 7 64bit. any ideas?

  20. Nick Brown says:

    nevermind. I have 2007, not 2010 office. silly me.

  21. ManelR says:

    Hi Brian,

    Only two cents for other users:

    CR/LF — You can edit the vbs in edit from a command prompt and it handles the lines correctly (edit SetTaskBar.vbs)

    Spanish — The verb you need to use instead of “Unpin from the Taskbar” is “Desanclar de la barra de tareas”; the same for the “Pin” part … is “Anclar a la barra de tareas”.

    Thanks for the code …

  22. ManelR says:

    Ooops … another comment, if you use edit and save the file … then notepad is able to read it perfectly without the CR/LF problem ;-)

  23. David says:

    Just to say thanks for this script and very helpful blog. Keep it up!

    BST regatrds.

  24. Jason says:

    Anyone figure out why my custom toolbar keeps going away after syspreping? and i get the pinned icons everytime

  25. Jason says:

    I used the script to remove the pinned icons but I am still loosing my toolbar that i created under c:\toolbar and locked it to the left but i loose it completly after a sysprep

  26. Jason says:

    Finally figured out my problem with the quick launch toolbar.
    I had to be out of audit mode for it to stay after syspreping. Not sure why this is but it now works. Only problem now is that it is on the right side and not staying on the left. I really don’t care that is minor. Everything is finally working. Thanks so much for all the help and tips.

  27. Jason says:

    Hey how would I edit this script to delete desktop.ini for all users? Please help:)

  28. Matt says:

    Thank You for all the help. The walk through for building unattend.xml was very helpful. I was experiencing massive trouble trying to get the taskbar icons to stay pin after sysprep. I have tried this script multiple time from different vantage point and success still eludes me. Anyone else experiencing this issue?? Anyone solved this issue? Any help would be great.

    Thank You

  29. Juel says:

    To all the Danish ppl:
    This is the pin command: “Frigør fra proceslinje”
    This is the Unpin command: “Fastgør til proceslinje”

  30. Taihlo says:

    Thanks for all the hard work on this, it’s helped us on our rollout more than two months of MS classes…

    Is there a way to get this script to run from startup without warning you about running VB Scripts?
    The UAC security controls get reset on sysprep as well, and we can’t even get our logon script to run correctly, so we would prefer to lose the extra prompt on the first logon ;-)

  31. [...] # Você pode colocar até 3 programas padrões adicionais na barra de tarefas. Mas o Internet Explorer, Windows Explorer e Windows Media Player ainda aparecerão por padrão para todos os novos usuários. Existem scripts na Internet que permitem personalizar totalmente a barra de tarefas após a instalação. Um dos mais interessantes pode ser encontrado aqui. [...]

Leave a Reply