Solved

Mapping network drive

Posted on 2012-04-02
11
1,076 Views
Last Modified: 2012-04-07
Hi,
How can I map a network drives when user logging in to windows 2003 R2 domain using logon script or group policy editor. I have the following two folders

\\myserver\home\%username%
\\myserver\public folder$

I want the mapped network drive to appear on the desktop and in my computer.

please help.

Thanks
0
Comment
Question by:ayha1999
  • 5
  • 4
  • 2
11 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37797114
You can have logon script to map the drives.

@echo off
Net use x: \\myserver\home\%username%
Net Use y: \\myserver\public folder$
0
 
LVL 7

Author Comment

by:ayha1999
ID: 37797164
what is the extension of the script file, bat or vbs? please give me the complete script and how to configure it.

thanks
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37797178
save the above lines as a bat file and put in the login script for the user.
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37797199
0
 
LVL 16

Accepted Solution

by:
uescomp earned 250 total points
ID: 37797203
As a slight recommendation I would use .vbs vs bat if you are running this from a server with windows 2008.  I have seen very strange issues before with bat files and vbs gives you alot more playing room.  Like mapping drives and printers etc if you wanted to do more.

Simple Example:

On Error Resume Next

Set objNetwork = CreateObject("WScript.Network")

'remove network drives
objNetwork.RemoveNetworkDrive "H:"
objNetwork.RemoveNetworkDrive "I:"
objNetwork.RemoveNetworkDrive "S:"


'map network drives
objNetwork.MapNetworkDrive "H:" , "\\servername\sharename"
objNetwork.MapNetworkDrive "I:" , "\\servername\sharename"
objNetwork.MapNetworkDrive "S:" , "\\servername\sharename"

'map network printer, must be shared off of server
objNetwork.AddWindowsPrinterConnection "\\servername\printersharename"

'set default printer
objNetwork.SetDefaultPrinter "\\servername\printersharename"
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 7

Author Comment

by:ayha1999
ID: 37797227
How can do it for all users one time instead of doing it for each user?

thanks
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37797248
Select all the users and open the properties and browse to the script.
0
 
LVL 7

Author Comment

by:ayha1999
ID: 37797612
I careated creted group policy, a bat file and put in the following location.

\\mydomain.com\SysVol\mydomain.com\Policies\{80B42946-49E6-4428-85F1-43C0B5382A88}\User\Scripts\Logon

but when user logs in , no network drive appears in my computer or desktop. If he browse the bat file located in above location and execute then it ask for user and and password and mapsthe network drives. is there any problem with the location?

thanks
0
 
LVL 7

Author Comment

by:ayha1999
ID: 37797624
The physical location is
C:\WINDOWS\SYSVOL\sysvol\mydomain.com\scripts
0
 
LVL 16

Assisted Solution

by:uescomp
uescomp earned 250 total points
ID: 37798264
Just to let you know if your AD structure is organized in a certain way I have seen problems when it was running.  Example:  You have the following Organizational Units (Company Users > Department 1 and Department 2)

You would have to create a group policy for both department 1 with the script and department 2 with the script.  I have seen it not run on many occasions when it was assigned to the top level which in this case would be (Company Users).  One thing you can do is do a \\Servername and navigate to the script and run it manually so see if it works.
0
 
LVL 7

Author Closing Comment

by:ayha1999
ID: 37819600
Thanks
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

759 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

18 Experts available now in Live!

Get 1:1 Help Now