Solved

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

Posted on 2011-03-25
4
285 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Rustici
Renato Montenegro Rustici 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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

636 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