Jump to content

Pin Items to Taskbar and/or Start Menu During Deploy


Recommended Posts

I found this tidbit on the MS site while trolling for other info. Thought it may be of use to others so I'm just sharing.

It explains how to automatically pin items to your taskbar or startmenu via scripting and includes an example script for calculator. I haven't tried this during an unattended install to see if it works as I'm still trying to work out other issues I'm having, but for others, this may be useful.

How to pin items to taskbar or start menu via scripting

Link to comment
Share on other sites

  • 2 months later...

Hi there!

Does anyone have any idea on how to do this for all users?

On Vista, all I add to do was:

1 - Configure the start menu with the pinned shortcuts that I wanted

2- Export the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage

And then I just need to run the registry file and restart the computer.

Now this is not working anymore.

Any ideias about it?

Best Regards,

Soultaker

Link to comment
Share on other sites

  • 1 month later...

I have played around with this for a while now, i figure someone else might be interested in the results:

Create a new WSH Script (which is very similar to that from the link posted by op). (http://blogs.technet.com/deploymentguys/ar...via-script.aspx)

My script (stored at C:\PinToTaskbar.vbs) looks as follows:

Set objShell = CreateObject("Shell.Application")
set filesystem = CreateObject("scripting.Filesystemobject")
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next

Create ONE batch file (at C:\PinItemsToTaskbar.bat) which then executes the above WSH script using cscript.exe for each program you want to pin.

"C:\Windows\System32\cscript.exe" "C:\PinToTaskbar.vbs" "C:\Program Files\Microsoft Office\Office12\WINWORD.exe"

"C:\Windows\System32\cscript.exe" "C:\PinToTaskbar.vbs" "C:\Program Files\Microsoft Office\Office12\VISIO.exe"

"C:\Windows\System32\cscript.exe" "C:\PinToTaskbar.vbs" "C:\Program Files\Microsoft Office\Office12\EXCEL.exe"

Create a registry script (at C:\PinOnce.reg) which will execute the above batch file at first logon for each user.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]
"SetupTaskbarPins"="C:\\PinItemsToTaskbar.bat"

Now load this registry file during your unattended installation within the auditUser pass before generalization (or however else you might try and do it)

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="auditUser">
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>500</Order>
<Path>cmd /c "REGEDIT /s C:\PinOnce.reg"</Path>
<Description>Load User Settings</Description>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
</unattend>

I have tried unsuccessfully, to execute the WSH script during the auditUser pass using a RunSynchronous command. I Have tried unsuccessfully to execute the WSH script using the OOBE FirstLogonCommand. I have tried setting the FirstLogonCommand parameter "RequiresUserInput" to both true and false.

I then tried to bypass the "PinItemsToTaskbar.bat" file by placing all the pin commands into the registry RunOnce; however it appears that the WSH script cannot be run multiple times simultaneously, and this caused unpredictable things to happen. The above steps are only method i have successfully used to pin items to the taskbar.

Edited by SmokingRope
Link to comment
Share on other sites

I have played around with this for a while now, i figure someone else might be interested in the results:

:thumbup

but i kinda tried something a little different. For those don't know as long as the path don't have spaces you don't need quotes. So just to play I tried these 2 in the PinItemsToTaskbar.cmd using WScript

WScript.exe %systemdrive%\Install\PinToTaskbar.vbs %windir%\explorer.exe

WScript.exe %systemdrive%\Install\PinToTaskbar.vbs %windir%\notepad.exe

so will need to test using WScript in the Firstlogon

Link to comment
Share on other sites

  • 8 months later...

@maxXPsoft, i have tried to execute the .cmd but without succeess, it does not pin any item.

I have tried multiple .vbs scripts tp pin ad unpin tasks from taskbar, but no one works for me, something i don´t do well. can someone help me please?

here are the scripts i have tried:

http://blogs.technet.com/b/deploymentguys/archive/2009/04/08/pin-items-to-the-start-menu-or-windows-7-taskbar-via-script.aspx

http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/7aef91e3-47c2-4d18-9156-383b374bca88

Edited by Major
Link to comment
Share on other sites

The scripts i have tried to install, i did it in a windows already installed, i don´t know if this situation would affect the executing of the script without any change.

I just done it on a running windows and it worked. Place the cmd file and the vbs script in same folder

PinTaskbar.cmd

cd /d %~dp0
WScript.exe %~dp0PinToTaskbar.vbs %windir%\explorer.exe
WScript.exe %~dp0PinToTaskbar.vbs %windir%\notepad.exe
Exit

PinToTaskbar.vbs

Set objShell = CreateObject("Shell.Application")
set filesystem = CreateObject("scripting.Filesystemobject")
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
Next

Link to comment
Share on other sites

I'll go crazy, i have done what you told me but without success, i don´t see no notepad neither no explorer on the taskbar.

I thought max was 3 but I keep running and more get added.

I had given that up and went back to Quicklaunch myself

Link to comment
Share on other sites

I think i am missing installing some libraries or some programs of windows to execute it because i have tried it in a running windows in vmware (only windows 7 is installed). i have seen that no file .vbs of adding or unpin item is executed, or i am wrong?

Thanks

Link to comment
Share on other sites

I disable UAC at offlineServicing and 1 other thing I am on Premium cause I didn't like having to Hide all the language updates on Ultimate. May have had an issue with ultimate running those scripts. I know I disabled that Taskbar Pinned part in my app while i worked on it.

Link to comment
Share on other sites

Is it possible to just use WinRar, make an .sfx archive of the quicklaunch icons you want and have them auto-extract to C:\Users\[ProfileName]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar? Or you could extract them to the default user profile. I used to do this in XP successfully. I am actually more interested in automatically removing the default quicklaunch items, unfortunately it seems that isn't possible. Any suggestions appreciated, have a good day everyone.

Kevin

Link to comment
Share on other sites

I have found the solution, the problem was i didn´t know how the script works. Then i see the script works as a right click on the item, i changed the words to spanish and it worked well.

Thanks you very much @maxXPsoft for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...