Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Script to map home drive for users

Posted on 2007-11-19
9
Medium Priority
?
3,713 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
Technology Partners: 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 2000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

864 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