Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map Drive with Username 1

Status
Not open for further replies.

peopleperson88

Technical User
Aug 8, 2002
46
US
Is there a method that I can create a script that will map drives based on their username?

Was thinking something like,

IF %USERNAME%==BobM
then
net use x: \\<server>\<share>
else
End If.

That doesn't work. Any ideas?
 
Win2K server has a built in feature to map home drives. Simply add it to the users profile. In the users properties, go to the Profiles tab and on the bottom, you will have the Home Folder section.

Select the Connect: option, put the letter you want it to use (in your case X:) and write the path to the share (\\server\share).

Windows 2000 and XP machines will automatically be mapped. If you have Win9x machines, simply add &quot;NET USE X: /HOME&quot; to the logon script.

If your usernames match the share names, you can do a batch edit of the users (select the users and do CTRL-ENTER) and edit the profiles like above, but for the share name add: \\<server>\%USERNAME%

and it will fill in %USERNAME% with the actual user name.

Hope this helps.



&quot;In space, nobody can hear you click...&quot;
 
I was aware of the home profiles. But what I was interested in was something that would map multiple drives based on their user account.

I figured it out and below is the script.


Thanks for the Help.


------------------------------
If %USERNAME%==BobM GOTO BobM
If %USERNAME%==MaryS GOTO MaryS

GOTO END

:BobM
net use t: \\<server>\<Share>
net use o: \\<server>\<Share>

:MaryS
net use g: \\<server>\<Share>
net use t: \\<server>\<Share>
net use o: \\<server>\<Share>

:End
 
Well, you'd want to edit that to have a goto end after the maps for BobM. If you do it as above you'll run the BobM section and then the MaryS section.

-Mike
 
Well I'm still having one issue..but then again it isn't really an issue maybe just by design.

The script is case sensative. BobM is not the same as bobm. So if the scripts reads;

IF $username%==BobM GOTO BobM

And the user type in their account as bobm it doesn't work.

Any solutions?

 
Use KIX.

It's in the Windows resource kit, and can do this (and more). It also has logic for &quot;in group&quot;. i.e. If user is in group &quot;Accounts&quot; then map all these drives...etc.

Cheers,
Sam

Please let members know if you found their posts helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top