locked
How to pin to start menu via script RRS feed

  • Question

  • Hi,

     

    Anyone knows how I can copy shortcuts/files/folders to the start menu in vista. (in the upper left section) via a login script (cmd)?

    In XP I could just copy files to a certain directory, but I cant find that dir in Vista?

     

    (Server 2003, active directory, cmd login script, vista clients)

     

    Thnx for any help.


     

    Thursday, October 18, 2007 9:04 AM

All replies

  • I do not know if this is the only procedure, but this is the one i used to do this:

     

    You have to create a regular shortcut (.lnk) 'somewhere'.

    Then you execute the same function as you would do manually (right-click, select Pin to Start Menu) by using a small vbscript.

     

    I did use the following script to pin the 'Connect To' function; the same script works for any .lnk.

    The script depends on the language of your operating system; change 'P&in to Start Menu' to the alternative string used by any other language. The exact syntax can be found by displaying all 'itemverb's'.

     

    Good luck!

     

     

    Code Block
    Set objEnv = CreateObject("Wscript.Shell")
    sAppdata=objEnv.ExpandEnvironmentStrings("%appdata%")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(sAppdata & "\microsoft\windows\start menu\programs")
    Set objFolderItem = objFolder.ParseName("Connect To.lnk")
    Set colVerbs = objFolderItem.Verbs
    For each itemverb in objFolderItem.verbs
        If itemverb.name = "P&in to Start Menu" Then itemverb.DoIt
    Next

     

     


     

    Friday, October 19, 2007 8:04 AM
  • Guys:

    I'm currently unable to make this work.  I pretty much create a shortcut to "notepad.exe \\server\hiddenshare$\sometextfile.xml" in the user's startup folder, and then I want it pinned to the start menu.  The script throws no errors, but the item is never pinned.

    I also tried other verbs and no verb is executing under my Vista Ultimate 64-bit edition installation.  Am I doing something wrong?  Or is it some security setting preventing me to launch verbs programatically?  Thank you all in advance.

    Tuesday, April 22, 2008 12:14 AM