Solved

Script to map home drive for users

Posted on 2007-11-19
9
3,693 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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