MasterRacker
New member
I create some desktop shortcuts in logon scripts. I'm always on the quest for the "best" way to do things. So what would you call the pros and cons of the two methods below?
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
Code:
' ----- Directly create shortcut on user's desktop
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
strDesk = WshShell.SpecialFolders("Desktop")
strShortcut = strDesk & "\Sample Shortcut.url"
If Not FSO.FileExists(strShortcut) Then
Set UrlLink = WshShell.CreateShortcut(strShortcut)
UrlLink.TargetPath = "[URL unfurl="true"]http://intranet.company.int/"[/URL]
UrllLink.IconLocation = "\\icons\sample.ico, 0"
UrllLink.Description = "Sample Shortcut"
UrlLink.Save
End If
' ----- Copy existing shortcut to user's desktop
LogonPath = WSHProcess("LogonServer") & "\netlogon\"
Set FileSys=CreateObject("Scripting.FileSystemObject")
Src = Logonpath & "Sample Shortcut.url"
If FileSys.FileExists(Src) Then
FileSys.CopyFile Src, Desktop, True
End If
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]