Windows – Pin “Run” to taskbar through group policy

group-policywindows

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:

  1. pinitem.vbs , but can only pin binaries.
  2. 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).

  1. Create a shortcut to rundll32.exe shell32.dll,#61 or c:\windows\explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0} like Zoredache suggested. Name it "Run."
  2. Right-click properties, choose the shortcut tab -> Change icon -> enter %windir%\system32\shell32.dll. Choose the standard run icon.
  3. 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.