How to force folder onto Desktop with Active Directory?

Discussion in 'Networking & Security' started by blazeking, Jul 6, 2009.

  1. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    Hi all,

    I'm tasked with providing a shared folder on every user's desktop on login to the Directory (AD 2003). It will be a remote server (//server1/user). Am I going in the direction of roaming profiles here? The folder structure already exists on server1... I just want to the shortcut to show on the desktop after a user logs in. Any ideas?
     
  2. Bviper

    Bviper [H]Lite

    Messages:
    117
    Joined:
    Oct 20, 2008
    Perhaps if you drop the shortcut in the default user desktop folder?
     
  3. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    That could work... but I've got users all over the place, and some use several computers. I'm hoping to setup a logon script or something similar.
     
  4. cyr0n_k0r

    cyr0n_k0r [H]ardness Supreme

    Messages:
    5,358
    Joined:
    Mar 30, 2001
    just make a login script that maps a drive to \\server1\%username% then adds a shortcut to it on %profilepath%\desktop

    easy as that.
     
  5. k1pp3r

    k1pp3r [H]ardness Supreme

    Messages:
    7,881
    Joined:
    Jun 16, 2004
    Just add this line to your login script, i have used it before

    copy /Y "\\server\folder\*.*" "%ALLUSERSPROFILE%\Desktop"

    Make sure the folder only has the one folder in it, that will be copied. You may need to use xcopy instead though
     
  6. Mabrito

    Mabrito [H]ardness Supreme

    Messages:
    7,004
    Joined:
    Dec 24, 2004
    Wouldnt that copy all the contents of the share to the folder on the desktop? He just needs a shortcut, not all of the contents copied to his computer.
     
  7. k1pp3r

    k1pp3r [H]ardness Supreme

    Messages:
    7,881
    Joined:
    Jun 16, 2004
    So just put the shortcut in the folder
     
  8. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    Thank you everyone - good suggestions here. Mapping a drive might work, but I'd like it better if I just created a desktop shortcut (or network place) instead. So if user1 logs in to any computer in the directory, a shortcut to "//server1/user1" is on the desktop. User3 would see //server1/user3... and so on. Maybe I need to script a .vbs and call it with a .bat file login script?

    If so, I'm stumped... I can copy/paste .vbs scripts, but I am no programmer.
     
  9. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    Ok, I found some code to steal from Microsoft's Scripting Guy :) Here it is:

    Const NETHOOD = &H13&

    Set objWSHShell = CreateObject("Wscript.Shell")
    Set objShell = CreateObject("Shell.Application")

    Set objFolder = objShell.Namespace(NETHOOD)
    Set objFolderItem = objFolder.Self
    strNetHood = objFolderItem.Path

    strShortcutName = "Backup Server"
    strShortcutPath = "\\fileserver\%username%"

    Set objShortcut = objWSHShell.CreateShortcut _
    (strNetHood & "\" & strShortcutName & ".lnk")
    objShortcut.TargetPath = strShortcutPath
    objShortcut.Save

    Set objShortcut = objWSHShell.CreateShortcut _
    ("C:\users\%username%\desktop\backup_server.lnk")
    objShortcut.TargetPath = strNetHood & "\" & strShortcutName & ".lnk"
    objShortcut.Save


    The network location works fine, and the desktop link *almost* works. The %username% variable does not work. It runs fine if I change it to my username "bking", but I want this to be the same variable as the one used in the shortcut path in the network places. Any idea of the correct variable path to put the network places item onto the desktop as a shortcut?
     
    Last edited: Jul 13, 2009
  10. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    Ok, finally got the .vbs script to do what I wanted (create a Network Place to \\server\%username%, then make a desktop shortcut). Here's the code:


    Const NETHOOD = &H13&

    Set objWSHShell = CreateObject("Wscript.Shell")
    Set objShell = CreateObject("Shell.Application")

    Set objFolder = objShell.Namespace(NETHOOD)
    Set objFolderItem = objFolder.Self
    strNetHood = objFolderItem.Path

    strShortcutName = "Backup Server"
    strShortcutPath = "\\fileserver\%username%"

    Set objShortcut = objWSHShell.CreateShortcut _
    (strNetHood & "\" & strShortcutName & ".lnk")
    objShortcut.TargetPath = strShortcutPath
    objShortcut.Save

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

    Set objShortcut = objShell.CreateShortcut(objDesktop & "\Backup_Server.lnk")
    objShortcut.TargetPath = strNetHood & "\" & strShortcutName & ".lnk"

    objShortcut.Description = "Creates link to folder share on backup server."
    objShortcut.WorkingDirectory = strDesktop

    objShortcut.Save



    This works when I run it from a client machine. However, when I push this via GPO in Win2003 AD, nothing happens. No error message, no folders, nothing. Any ideas?
     
  11. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    I recall this thread......had to revisit it today.
    The new Q&A guy wants to have browser shortcut put on all users desktops. It's an http://blah blah blah some very long URL link that he needs..and he wants it to be named "MSDS"..and be available on all users desktops, including laptop users who roam in and out of the office.

    Me stumped on the approach on getting it done.
     
  12. vertices

    vertices Limp Gawd

    Messages:
    225
    Joined:
    Apr 14, 2002
    Why can't you just do it with Client Side Preferences?
     
  13. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    If it helps, I finally got my GPO to work correctly. I was processing that script to run against the computer, instead of the user. As soon as I put it as a "LOGON" script, rather than a "STARTUP" script, that did the trick.
     
  14. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
    Maybe he doesn't have Server 2008?
     
  15. dbwillis

    dbwillis [H]ardness Supreme

    Messages:
    7,576
    Joined:
    Jul 9, 2002
    I found a nice app (old app) called "Repl123" made by Julietta Alaverdian
    put a list of machines in it and point it to the file to deploy and where to deploy it and press 'replicate'
    I pushed Cpuz to ~1200 machines last night in ~8min
     
  16. scobar

    scobar .

    Messages:
    34,013
    Joined:
    Jan 2, 2001
    What's funny is you start putting stuff on people's desktops and they will start to complain about extra junk they don't care about.

    We setup an intranet with all the crap that people want people to see, but so many people can't click their way out of a wet paper bag, so, no one either A.) knows about it, B.) wants to use it C.) Don't give a shit.

    Just my 2 cents.
     
  17. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    Yeah I know..but it's being directed by Q&A management....and management of this clients approves my invoices..thus pays my bill.
     
  18. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    My Google skillz apparently lacking in finding this "Repl123". :(
     
  19. vertices

    vertices Limp Gawd

    Messages:
    225
    Joined:
    Apr 14, 2002
    I couldn't find anything either, by her name or Repl123. Links please. This could be handy.
     
  20. dbwillis

    dbwillis [H]ardness Supreme

    Messages:
    7,576
    Joined:
    Jul 9, 2002
  21. Goatbert

    Goatbert Limp Gawd

    Messages:
    176
    Joined:
    Jan 17, 2005
  22. blazeking

    blazeking [H]Lite

    Messages:
    126
    Joined:
    Nov 16, 2004
  23. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    Trying it..but running from SBS2K3r2...getting error "Class not registered. You need the following file to be installed on your machine. MSSTDFMT.DLL.

    Dunno if I want to go down that path.
     
  24. TechieSooner

    TechieSooner [H]ardness Supreme

    Messages:
    7,601
    Joined:
    Nov 7, 2007
    I had a script at one point that did exactly this. I had a link to our internal website...
    I don't use that script anymore, I'll try to find it again.
     
  25. TechieSooner

    TechieSooner [H]ardness Supreme

    Messages:
    7,601
    Joined:
    Nov 7, 2007
    Here you are:

    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Bing Website.url")
    oUrlLink.TargetPath = "http://www.bing.com"
    oUrlLink.Save

    Tested this in XP and Vista both...
     
  26. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    I tried pushing the file with Group Policy.
    It's an Internet Explorer shortcut...called Welcome to MSDS online HQ

    It's SBS2K3 R2 that runs their network.
    I created and linked a GPO, went to User Config, Windows Settings, Internet Explorer Maintenance, URLs/Favorites and Links..and I added the favorite and plugged in the long link.

    gpupdate /force....and I remoted into another computer on the network and it was in the IE favorites list.

    Cool...so I went to Administrator Templates in the GPO, Desktop/Active Desktop, Add/Delete items...and hoped I could copy that IE shortcut to desktops through this. At first I had the file located in say, C:\Download\Welcome to MSDS online HQ
    no luck
    I then tried putting that IE shortcut in the default share of ClientApps..and added the UNC path instead. So \\server\clientapps\Welcome to MSDS online HQ

    Still no luck.

    Does Active Desktop have to be enabled in the GPO in order to copy files to it?
     
  27. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    You Rock TS! Ended up doing the script approach..and it's working.
     
  28. YeOldeStonecat

    YeOldeStonecat [H]ardForum Junkie

    Messages:
    11,330
    Joined:
    Jul 19, 2004
    Assuming it ignores if the object already exists?
     
  29. Electrofreak

    Electrofreak [H]ard|Gawd

    Messages:
    1,080
    Joined:
    Aug 5, 2008
    I don't think it matters; if it creates a link with the exact same name it should just overwrite the previous one.
     
  30. TechieSooner

    TechieSooner [H]ardness Supreme

    Messages:
    7,601
    Joined:
    Nov 7, 2007
    Yea, it doesn't throw up any errors or anything to the user, which is all I had cared about.
     
  31. TechieSooner

    TechieSooner [H]ardness Supreme

    Messages:
    7,601
    Joined:
    Nov 7, 2007
    Yea, scripting seems alot easier. I've finally got my scripts working with ease.

    I've got Launchapp working for the Vista clients, along with the XP clients. So it's pretty good... I have a CMD file run (which can take care of command-line stuff like NET USE), which then later calls each of my vbs scripts (that do things like create this desktop shortcut). And I only ever have 1 VBS script do 1 thing. 1 maps drives, 1 gives them the network use message, 1 gives them the desktop icon, etc.

    Makes scripting very easy.
     
  32. QwertyJuan

    QwertyJuan [H]ardForum Junkie

    Messages:
    11,287
    Joined:
    Aug 17, 2000
    Why a desktop shortcut?? Why can't it just be a mapped drive?? :confused:
     
  33. TechieSooner

    TechieSooner [H]ardness Supreme

    Messages:
    7,601
    Joined:
    Nov 7, 2007
    Some users are whiny. It's alot easier to give them a darn shortcut via a script than to teach them how to find "my computer"... Retarded, I know... But sometimes it's not worth the battle.
     
  34. QwertyJuan

    QwertyJuan [H]ardForum Junkie

    Messages:
    11,287
    Joined:
    Aug 17, 2000
    Sheesh... :)

    My users would complain if I had a shortcut on their desktops now... they like their 'S' drive! :D