Solved

Script to map home drive for users

Posted on 2007-11-19
9
3,655 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
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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now