[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

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
0
jerrywalk1
Asked:
jerrywalk1
1 Solution
 
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.

BB
0
 
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.
0
 
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"
    NewShortcut.Save
    End If

    Set objFSO = nothing
    Set objShell = nothing

    WScript.Quit

BB
0
 
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:
http://www.group-policy.com/gp%5Cshortcuts.smp

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:\
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now