Solved

In a login script how can I map to the users name

Posted on 2011-03-25
4
281 Views
Last Modified: 2012-05-11
In a login script how can I map to the users name
Something like net use h:  \servername \ users\%username%

I am trying to remember ,is there something special to do this
0
Comment
Question by:NAMEWITHELD12
4 Comments
 
LVL 11

Accepted Solution

by:
nordtorp earned 125 total points
ID: 35218611
Please see code below. This is a vbscript.

Set objNetwork = CreateObject("WScript.Network") 
strDriveLetter = "H:" 
strHomeServer = "\\server\users\" 
strUserName =objNetwork.UserName 
objNetwork.MapNetworkDrive strDriveLetter, strHomeServer & strUserName

Open in new window

0
 
LVL 11

Assisted Solution

by:willettmeister
willettmeister earned 125 total points
ID: 35218619
no you can do it exactly like you are saying except you need to to use proper unc convention

\\server\users\%username%

or in vb
\\\\server\\users\\%username%
0
 

Assisted Solution

by:oldriggerrs
oldriggerrs earned 125 total points
ID: 35218732
It's easiest to do this in active directory. Locate the user, right click and go to properties. Click the Profile tab and fill in the local path in the home folder section. Now just have the user login and that drive is mapped.

If it has to be a login script the line should look like this:
net use u: \\servername\users\%username%

Please note the space between the u: and the \\.
0
 
LVL 11

Assisted Solution

by:Renato Montenegro Rustice
Renato Montenegro Rustice earned 125 total points
ID: 35224481
Why dont you use Drive Maps?

GP Preferences Will Reduce Logon Scripts : Mapping Drives
http://blogs.technet.com/b/grouppolicy/archive/2009/02/11/gp-preferences-will-reduce-logon-scripts-mapping-drives.aspx

Note that you can use the %logonuser% variable to do what you want.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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