Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Propellor Head debate over 2 methods

Status
Not open for further replies.

MasterRacker

New member
Oct 13, 1999
3,343
US
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?
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]
 
Personally, I wouldn't store shortcuts in the netlogon folder. I would also go with method two. There are fewer points of error. Also, method one would create a visually bogus shortcut if DNS wasn't working, .IconLocation would not resolve.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Interesting, I had never considered DNS being down. Bu the flip side of that is why the master shortcut and icon ore in netlogon. Since that's where the script runs from, the client is guaranteed to be able to get the shortcut and icon.

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]
 
Also is the case if the file is located in another folder on the logon server (excluding human error). If I were to take over your position, I would be totally baffled as to why there are non logon file in the logon folder. Would you want a client to save absolutely everything to the root of c:?

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
If I had hundreds I would consider putting them elsewhere. Since I only have a few and they are 'templates' to be used only at logon, in a sense, they logon files.

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]
 
I agree with Geates on not putting extra stuff in netlogon. Create a new share that everyone has read access to and copy them there if you are doing the file copy.

I will disagree with Geates on the method. I prefer the programmatic method (1). If your file share is inaccessible then they don't get an shortcut at all. I would rather they get a bad looking icon that works than not have the shortcut at all.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top