Solved

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

Posted on 2011-03-25
4
280 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
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 sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

861 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

20 Experts available now in Live!

Get 1:1 Help Now