Need script to create shortcut on client desktops to helpdesk website

Posted on 2009-02-22
Last Modified: 2012-06-27
Hello Experts,
I been working on this for a while and have had little luck...probablly since I am a novice at scripting. I need a script that will create an icon (using a .ico) in "AllUsersPrograms" program files directory and pin it to the start menu. When users would click on this would take them to a helpdesk website on the internet. Ideally, I would like to deploy this with group policy. I found the code below and tried to adapt it to my situation but cound not get the icon to appear on the desktop. Just a generic IE icon appeared...but it worked otherwise. I also included some other code below that pins items to start menu that I found on an MSDN forum. Thanks a bunch! -John
Dim oFSO, oLnk, WshShell, strDesktop

set WshShell = CreateObject("WScript.Shell")

strDesktop = WshShell.SpecialFolders("Desktop")

set oFSO = CreateObject("Scripting.FileSystemObject")

Set oLnk = oFSO.CreateTextFile(strDesktop & "\Poco Oil Website.url", True)

oLnk.WriteLine "[DEFAULT]"

oLnk.WriteLine "BASEURL="


Here, for example, is a script that pins the Windows Calculator (calc.exe) to the Start Menu:

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace("C:\Windows\System32")

Set objFolderItem = objFolder.ParseName("calc.exe")


oLnk.WriteLine "[InternetShortcut]"

oLnk.WriteLine "URL="

oLnk.WriteLine "IconFile="


Open in new window

Question by:DigicomDental
    1 Comment
    LVL 65

    Accepted Solution

    Hi, you should create a link file using the CreateShortcut method.


    Dim objFSO, objLnk, objShell, strDesktop, strStartMenu
    Set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strDesktop = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop"
    strStartMenu = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu"
    Set objLnk = objShell.CreateShortcut(strDesktop & "\Poco Oil Website.lnk", True)
    objLnk.TargetPath = ""
    objLnk.Description = "Help Desk"
    objLnk.IconLocation = ""
    objFSO.CopyFile strDesktop & "\Poco Oil Website.lnk", strStartMenu & "\Poco Oil Website.lnk", True

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    More or less everybody in the IT market understands the basics of Networking, however when we start talking about Storage Networks, things get a bit dizzier, and this is where I would like to help.
    Learn about cloud computing and its benefits for small business owners.
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now