Solved

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

Posted on 2011-03-25
4
279 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

763 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