Create All Users/Public Users desktop shortcuts
Looking for a good way to create Desktop shortcuts for users. I have the K1100 and have tried the script wizard that is built in but for some reason it doesn't seem to work.
Answers (5)
Try with this VBScript
Option Explicit
On Error Resume Next
Dim objShell,lnk,ProgramFiles,PublicFold
Set objShell = CreateObject("WScript.Shell")
ProgramFiles=objShell.ExpandEnvironmentStrings("%ProgramFiles%")
PublicFold=objShell.ExpandEnvironmentStrings("%Public%")
Set lnk = objShell.CreateShortcut(PublicFold & "\Desktop\MyShortcut.LNK")
lnk.TargetPath = ProgramFiles & "\MyApp\MyProgram.exe"
lnk.Arguments = ""
lnk.Description = "MyProgram"
lnk.HotKey = "ALT+CTRL+F"
lnk.IconLocation = ProgramFiles & "\MyApp\MyProgram.exe, 0"
lnk.WindowStyle = "1"
lnk.WorkingDirectory = ProgramFiles & "\MyApp"
lnk.Save
Set lnk = Nothing
Set objShell = Nothing
WScript.Quit
Zip all of your shortcuts (.lnk) up along with a .cmd file. Call your .cmd in the install command like you usually would.
@echo off
copy /y shortcut.lnk "%public%\desktop"
copy /y shortcut2.lnk "%public%\desktop"
copy /y shortcut3.lnk "%public%\desktop"
Comments:
-
You can also ZIP your shortcuts and create an online Kscript.
Add your ZIP as a dependency.
VERIFY the shortcuts exist %public%\desktop\shortcut.lnk
REMEDIATION Unzip a File
Directory: $(KACE_DEPENDENCY_DIR)
File: <Name of ZIP in dependency>
Target: c:\users\Public\desktop - dugullett 11 years ago -
Thanks a bunch. I'll give it a shot. - ckubaska 11 years ago
I would assume that you are targetting systems that are Windows Vista and above since you are using the Public profile for All Users. Also, you are getting the "%ProgramFiles%" variable and not the "%ProgramFiles(x86)%" variable so you must be either only running on 32-bit or the software is 64-bit. Either way, the below script works just fine for me.
Option Explicit
On Error Resume Next
Dim objShell, lnk, ProgramFiles, PublicFold
Set objShell = WScript.CreateObject("WScript.Shell")
ProgramFiles = objShell.ExpandEnvironmentStrings("%ProgramFiles%")
PublicFold = objShell.ExpandEnvironmentStrings("%PUBLIC%")
Set lnk = objShell.CreateShortcut(PublicFold & "\Desktop\MyShortcut.lnk")
lnk.TargetPath = ProgramFiles & "\MyApp\MyProgram.exe"
lnk.Arguments = ""
lnk.Description = "MyProgram"
lnk.HotKey = "ALT+CTRL+F"
lnk.IconLocation = ProgramFiles & "\MyApp\MyProgram.exe, 0"
lnk.WindowStyle = "1"
lnk.WorkingDirectory = ProgramFiles & "\MyApp"
lnk.Save
Set objShell = Nothing
Set lnk = Nothing
ProgramFiles = Null
PublicFold = Null