Is there are way to pin the "Run" button to taskbar through group policy or a script?
Only the specific items needs to be pinned. The other items are not to be touched.
Partial solutions I found on net:
- pinitem.vbs , but can only pin binaries.
- The powershell solution uses the same mechanism.
Best Answer
I used partly the powershell you linked and partly Zoredache's stuff, and found the icon for the shortcut myself (not that huge a deal; I had an example in my start menu).
rundll32.exe shell32.dll,#61
orc:\windows\explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}
like Zoredache suggested. Name it "Run."%windir%\system32\shell32.dll
. Choose the standard run icon.Run the powershell script:
$shell = new-object -com "Shell.Application"
$folder = $shell.Namespace('C:\path\to\run\icon')
$item = $folder.Parsename('run.lnk')
$item.invokeverb('taskbarpin')
You can put the icon on a user share (copying it to the workstation first?) and assign the powershell as a login script via group policy.
I tested running the script manually on Windows 7 and Windows 8. It didn't create duplicates when re-run.