create shortcut to users home drive

I need a simple script that will run in setup.bat when users log on that will take their U drive which is their home drives and create a desktop shortcut. Everyone uses the U drive as this is setup in the AD users profiles.
Windows 2003 R2
desktops/laptops windows 7
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael OrtegaSales & Systems EngineerCommented:
I'm a little confused as to what you're trying to accomplish.  Is the U drive a mapped drive shared off the server?  If so, you may consider creating a Group Policy to automatically map the drive for each user that needs it.

SandeshdubeySenior Server EngineerCommented:
jerrywalk1Author Commented:
The network drive is already mapped. All i am trying to do is a script that will create a desktop shortcut to that drive letter.
Michael OrtegaSales & Systems EngineerCommented:
Something like this?  It would need a bit of tweaking as I do not know the location of the U drive in your network.

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")

    DesktopPath = objShell.SpecialFolders("Desktop")
    Set NewShortcut = objShell.CreateShortcut(DesktopPath & "\Udrive.lnk")

    If Not objFSO.FileExists (NewShortcut) Then
    NewShortcut.Description = "U Drive"
    NewShortcut.IconLocation = "%SystemRoot%\system32\SHELL32.dll,88"
    NewShortcut.TargetPath = "\\server\locationofUdrive"
    End If

    Set objFSO = nothing
    Set objShell = nothing


Spike99On-Site IT TechnicianCommented:
If you have a U: drive mapped, just create a shortcut to U:\.  Then, place that shortcut to a location readable by all users.  Then, create a batch file that will run at logon that will copy that shortcut from that central loacation to their desktop folder.

For that batch to work for all users, however, you'd have to use the %userprofile% variable in the batch for the relative location of their local desktop folder.

For example, for the desktop folder in their local user profile folder, you can use %userprofile%\desktop in place of the full path. That will copy the link to their desktop whether or not they're on server 2003 (which would be C:\Documents and Settings\USERNAME\Desktop) or on Windows 7 (C:\Users\USERNAME\Desktop).

Or, if you are  in a domain environment, you could use group policy to push out the shortcut to users' desktops. Here's a link that has some screenshots on how to do that:

If you choose that route, I'd think you'd select "File System Object" for Target Type, then just select Desktop for the location.  For the target path, just type:  J:\

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Server Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.