Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

script to map network drive

Posted on 2012-04-08
6
Medium Priority
?
620 Views
Last Modified: 2012-08-14
Can someone tell me what syntax i should use  on the login script to map network drive? The server is windows 2003. if they have something already map to that drive than i want  the new map drive to overwrite.


thanks
0
Comment
Question by:officertango
[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
6 Comments
 
LVL 12

Assisted Solution

by:Sandeep
Sandeep earned 501 total points
ID: 37822432
Please see to below link which should drive you through how to do mapping of network drive.

http://homepages.ius.edu/jholly/a247/labs/logonscript.htm
0
 
LVL 17

Assisted Solution

by:Anuroopsundd
Anuroopsundd earned 498 total points
ID: 37822434
below script map \\localhost\i$ as S drive. if s: exist it will disconnect it and then final line of code will map the drive.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("WScript.Network")
strLocalDrive = "S:"
strRemoteShare = "\\localhost\I$"
if(ObjFSO.DriveExists(strLocalDrive)) then
objNetwork.RemoveNetworkDrive strLocalDrive, True, True
end if
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare
0
 
LVL 31

Accepted Solution

by:
Frosty555 earned 501 total points
ID: 37822436
Here's a login script I've used for a client in the past. It includes a bit of logic that lets me map special drives for specific user accounts, and also map a "personal" shared drive for each employee.

All users get the H:\ drive mapped to their personal shared folder
Two special users - jsmith and janedoe, get a special folder mapped to the G:\ drive.
Everybody else gets the F:\ drive mapped to a different shared folder

NETLOGON.BAT:
if (%username%)==(jsmith) goto jsmith
if (%username%)==(janedoe) goto janedoe
goto otherusers

REM jsmith doesn't have access to the F drive. Make sure it isn't mapped
:jsmith
net use F: /delete
net use G: /delete
net use G:  \\SERVER1\CompanyPublic
goto allusers

REM janedoe doesn't have access to the F drive. Make sure it isn't mapped
:janedoe
net use F: /delete
net use G: /delete
net use G:  \\SERVER1\CompanyPublic
goto allusers

REM everybody else gets the F drive mapped
:otherusers
net use F: /delete
net use F:  \\SERVER1\Data
goto allusers

REM all users get the H drive mapped to their personal storage folder
:allusers
net use H: /delete
net use H: \\SERVER1\UserShares\%username%
goto exit

:exit

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:officertango
ID: 37822514
Ok, i got the syntax down but the script will not start automatically when i login to domain. i can start it manually and it works fine. i put the login.bat in c:\windows\sysvol\domain name\scripts and it does not launch automatically. what am i doing wrong?


thanks
0
 
LVL 5

Expert Comment

by:gortm001
ID: 37822672
You either have to specify the script to run in a Group policy, or put the name in the logon script field in the users profile tab in Active directory. If you do the latter, do not put a full path in there, because it by default uses the scripts path. So in your case, just add login.bat in the field.

So I would say it just depends on the amount of users you have to edit which way you prefer.

Hope this helps,

KG
0
 

Author Closing Comment

by:officertango
ID: 37856766
na
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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