How To Pin Items To The Top of the Start Menu Via Script

Product: ProfileUnity          

Product Version: 6.0+

Expires on: 365 days from publish date

Updated: July 28, 2015



Customer wants to pin items to the top of the Start menu, the same as if a user right-clicked an icon and chose 'Pin to Start Menu'. See image below.




Microsoft, by default, does not allow installers to put icons in this location. Per this Microsoft article:

This was done deliberately to prevent installation programs from spamming these locations with their icons ( This caused many customers to have to take manual steps in the image build process to configure pinned items.  However, there is an indirect way to automate this by using the Shell Objects for Scripting.

Microsoft provides a script attached to that article that will pin items to the start menu. 

That script has several caveats, though:

  1. It can only pin .lnk shortcut files, not Internet shortcuts (.url). To create those, make a .lnk shortcut pointing to iexplore.exe.
  2. The script cannot pin shortcuts to UNC paths or mapped network drives—possibly a Windows security limitation. The script below copies the .lnk files locally first.
  3. The script also only works in US English, as it relies on English keywords.

The following batch file will copy the icons from a network location to %temp% on the local machine, then pin those links to the start menu:

@echo off
mkdir %temp%\copyicons
copy "\\ad\NETLOGON\ProfileUnity\cmd\*.lnk" %temp%\copyicons
%systemroot%\system32\cscript.exe \\dc\netlogon\ProfileUnity\cmd\PinItem.vbs /item:"%temp%\copyicons\Calculator.lnk"
%systemroot%\system32\cscript.exe \\dc\netlogon\ProfileUnity\cmd\PinItem.vbs /item:"%temp%\copyicons\LwL Test.lnk"

Unzip the attached .zip file and modify the batch file to point to the correct locations, then add an Application Launcher rule to launch the .cmd script. 


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Article is closed for comments.