[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

Need script to create shortcut on client desktops to helpdesk website

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 icon...it 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=http://12.159.249.114"
 
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=http://12.159.249.114/index.htm"
oLnk.WriteLine "IconFile=http://12.159.249.114/favicon.ico"
oLnk.Close

Open in new window

0
DigicomDental
Asked:
DigicomDental
1 Solution
 
RobSampsonCommented:
Hi, you should create a link file using the CreateShortcut method.

Regards,

Rob.
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 = "http://12.159.249.114/index.htm"
objLnk.Description = "Help Desk"
objLnk.IconLocation = "http://12.159.249.114/favicon.ico"
objLnk.Save
objFSO.CopyFile strDesktop & "\Poco Oil Website.lnk", strStartMenu & "\Poco Oil Website.lnk", True

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now