How to create desktop shortcut?

Author Message
scheng725
  • Total Posts : 192
  • Scores: 1
  • Reward points : 0
  • Joined: 8/15/2005
How to create desktop shortcut? - Thursday, October 26, 2006 6:06 AM
0
Hi all,
 
The objective is to create a URL Shortcut onto a group of SMS client desktops. I am thinking of creating a vbs file, and using SMS Software rollout.
 
The vbs file is shown as follows:
 
                 Dim sFile 
                 Dim dFolder
                 Dim objFSo
 
                 Set objFSo=createobject("Scripting.FileSystemObject")
                 sFile = \\SMSServer\Scripts\shortcut.vbs     ' This is my SMS Local  drive
                 dFolder = "%AllUserProfile%\Desktop" ' This is the targeted computer
                 objfso.copyfile sfile, dfolder
 
Is this script work? How about if I want to delete any known shortcut, on the all user profiles\ desktop, before the new shortcut is copied?
 
Thanks in advance!
 

admin
  • Total Posts : 500
  • Scores: 52
  • Reward points : 91690
  • Joined: 6/1/2002
  • Location: admin@myITforum.com
RE: How to create desktop shortcut? - Thursday, October 26, 2006 7:55 AM
0
You could use SMS Installer...
 
http://www.myitforum.com/articles/12/view.asp?id=4009

skissinger
  • Total Posts : 4937
  • Scores: 473
  • Reward points : 137360
  • Joined: 9/13/2001
  • Location: Sherry Kissinger
RE: How to create desktop shortcut? - Thursday, October 26, 2006 1:36 PM
0
For deleting all instances of an icon within c:\documents and settings\ <all folders> \desktop, I've used the attached vbscript.  I didn't write it, and I actually don't quite understand it, but it works and that's all that matters to me.  That particular example is to delete a shortcut called 'flow.url' from the quick launch and from the desktop of any profiles in c:\documents and settings.
 
To add a URL shortcut on the desktop, you could use something like this w/vbscript.  If you want the AllUsers desktop instead of current user, just switch it in the code.  If you use all user, you can run it via SMS 'whether or not user is logged in'.  The script below would delete the Our Intranet.URL file before making the one you want.
 
Set sho = Wscript.CreateObject("Wscript.Shell")
Set fso = wscript.CreateObject("Scripting.FileSystemObject")
strUserProfile = sho.expandenvironmentstrings("%Userprofile%")
strAllUsersProfile = sho.expandenvironmentstrings("%AllUsersProfile%")
If fso.fileexists (struserprofile & "\Desktop\Our Intranet.URL") then
   fso.deletefile(struserprofile & "\Desktop\Our Intranet.URL")
   Set MyFile = fso.CreateTextFile(struserProfile & "\Desktop\Our Intranet.URL", True)
   MyFile.WriteLine("[InternetShortcut]")
   MyFile.WriteLine("URL=http://Intranet/HomePage.htm")
   MyFile.WriteLine("Modified=E033CFC5A41DC5012E")
   MyFile.WriteLine("IconIndex=0")
   MyFile.WriteLine("IconFile=C:\Icon_Folder_Populated_Somehow\OurIntranet.ico")
   MyFile.Close
End If 
Attachments are not available: Download requirements not met - - -

eschloss
  • Total Posts : 606
  • Scores: 27
  • Reward points : 23670
  • Joined: 9/7/2004
  • Location: Cincinnati
RE: How to create desktop shortcut? - Friday, October 27, 2006 10:17 AM
0
Dim WshShell
set WshShell = CreateObject("wscript.Shell")
 
DesktopPath="C:\Documents and Settings\All Users\Desktop"
ShortcutName="My Shortcut.url"
ShortcutPath="http://link_to_my_site"
Set Shortcut = WSHShell.CreateShortcut(DesktopPath & "\" & ShortcutName)
Shortcut.TargetPath = ShortcutPath
Shortcut.Save

mp115
  • Total Posts : 302
  • Scores: 7
  • Reward points : 22670
  • Joined: 3/23/2005
RE: How to create desktop shortcut? - Friday, October 27, 2006 10:29 AM
0
You could also use makescut.exe, a free utility that I use in our KiXtart scripts.  It's part of a larger free toolkit from ScriptLogic.
 
http://www.scriptlogic.com/products/scriptingtoolkit/default.asp
 
 
Here's a snippet on the syntax I use in KiXtart to generate a desktop icon in 2000/XP... it's got more options, but I only use the basic settings.
 
 
%COMSPEC% /C makescut.exe /n %userprofile%\desktop\Notepad.lnk /t c:\windows\notepad.exe /o"

sjeffery
  • Total Posts : 81
  • Scores: 0
  • Reward points : 0
  • Joined: 11/23/2004
  • Location: Southern Sunny England
RE: How to create desktop shortcut? - Friday, August 10, 2007 10:33 AM
0
That is a brilliant little script, thanks for sharing that with us all!