We help IT Professionals succeed at work.

Create Desktop Shortcut Script Problems

JohnnyD74
JohnnyD74 used Ask the Experts™
on
Hello Experts,
I am trying to develop a script that I can push out to my client computers that will create a desktop shortcut to a program. I use a program called "LabTech" which utilizes a windows service that runs as "LocalSystem".  I send the script to remotely and it executes the script on the computer.
I am using the following script to create a desktop shortcut and it works fine if I click on it while it is on the desktop but does not work when the LocalSystem account executes it. Any Ideas?

Thanks!

' CreateShortCut.vbs - Create a Desktop Shortcut.
' VBScript to create .lnk file
' Author Guy Thomas http://computerperformance.co.uk
' Version 2.4 - July 2006
' ----------------------------------------------------------'
Option Explicit
Dim objShell, objDesktop, objLink
Dim strAppPath, strWorkDir, strIconPath

' --------------------------------------------------
' Here are the variables that to change if you are making a 'real' script

'EDIT THESE LINES:
strWorkDir ="C:\windows\LTSvc"
strAppPath = "%windir%\LTSvc\LTtray.exe"
strIconPath = "%windir%\LTSvc\LTtray.exe"

Set objShell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")

'EDIT THIS LINE:
Set objLink = objShell.CreateShortcut(objDesktop & "\LTtray.lnk")

' ---------------------------------------------------
' Section which adds the shortcut's key properties

'EDIT THIS LINE:
objLink.Description = "LTtray"

objLink.IconLocation = strIconPath
objLink.TargetPath = strAppPath
objLink.WindowStyle = 3
objLink.WorkingDirectory = strWorkDir
objLink.Save

WScript.Quit

' End of creating a desktop shortcut


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
DesktopPath = Shell.SpecialFolders("Desktop") will return the desktop for the current user.

You need to create the point for the All Users desktop
DesktopPath = Shell.SpecialFolders("AllUsersDesktop")

Author

Commented:
Thanks! That that exactly the problem!