Solved

Script to map home drive for users

Posted on 2007-11-19
9
3,699 Views
Last Modified: 2008-02-01
Currenly I mapping a users "h" home drive with an entry in the users properties under the home folder path. I would like to script so that when users log in they are mapped to their h drive on a server.

Each user has a shared with with the correct permissions on the server. The share is username$
So in the home folder properties its \\server\username$

Thanks in advance
0
Comment
Question by:vmamedov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Author Comment

by:vmamedov
ID: 20314370
I would also like to use DFS, so the location of the home drive would be \\domain\share\share\username$
0
 
LVL 6

Expert Comment

by:MorDrakka
ID: 20314419
Hi,

As i understand correctly, you do NOT wish to use the AD integrated homefolder option en want to script it ?

How about this in the loginscript:

Net use H: \\domain\share\share\%username%$

Where you use the environment variable %username%

If I do not understand correctly please say so :p

M
0
 

Author Comment

by:vmamedov
ID: 20314444
I have tried that and it doesnt work, it doesnt map the drive,
also i am looking for a vb script not batch
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20314470
Try this..........


regards
Chandru
Set objSysInfo = CreateObject("ADSystemInfo")
 
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
 
strUserName = objUser.samAccountName
 
strDrive = "\\domain\share\share\" & strUserName & "$"
 
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "H:", strDrive

Open in new window

0
 
LVL 6

Expert Comment

by:MorDrakka
ID: 20314478
arg C beat me again. /sigh
0
 

Author Comment

by:vmamedov
ID: 20314805
chandru, thanks for your help
after running the script i am getting the following error

---------------------------
Windows Script Host
---------------------------
Script:      C:\Documents and Settings\user\Desktop\hdrives.vbs
Line:      11
Char:      1
Error:      The system cannot find the file specified.

Code:      80070002
Source:       WSHNetwork.MapNetworkDrive

---------------------------
OK  
---------------------------
0
 

Author Comment

by:vmamedov
ID: 20314942
i figured out what i was doing, there was a problem with DFS

thanks both
0
 

Expert Comment

by:AdrianWhitehurst
ID: 20375105
How did you fix the issue? I am getting same error when I run the script.
0
 

Author Comment

by:vmamedov
ID: 20382253
adrian whats is the problem that you are having?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question