Link to home
Start Free TrialLog in
Avatar of Randy Johnson
Randy JohnsonFlag for United States of America

asked on

Mapping a Network Drive through a Script

Is there  a tool or a tutorial that can help me create a script that will map network drives after a user has logged on and the desktop is showing?

Randy
Avatar of A Syscokid
A Syscokid

A simple command

net use x: \\servername\sharename

is all you need, where X: is the drive letter you want to map.  Or you could do

net use x: /d
net use x: \\servername\sharename

where /d will delete any existing mapping to that drive letter.  Put it in a batch file.
Avatar of Randy Johnson

ASKER

Exand on the above and tell me how to do it with a username and password associated with it.
"KiXtart is a logon script processor and enhanced batch scripting language for computers running Windows XP, Windows 2000, Windows NT or Windows 9x in a Windows Networking environment"

http://www.kixtart.org/

Download the files, then put them in \\domaincontroller\netlogon,

Create a file named kixtart.scr in \\domaincontroller\netlogon

***Example File***
CLS

USE I: "\\server\install"

IF INGROUP("Domain Admins")
USE X: "\\srever\admins"
ENDIF

USE S: "\\server\shared"
SETTIME "\\domaincontroller"

EXIT
***************

Finish by setting the logon script to kix32 for all users you want to run logon scripts

Active Directory Users and Computers
Click on Users
Right Click on the User, Choose Properties
Go to the Profile tab
type "kix32" under the logon script dialog box.
follow asyscokid's discription to write the batch file, then go your default group policy for the domain and in
User configuration/windows settings/Scripts, add the batch file as a logon script.

to assign different settings to different users, create and ou for each group of users, put the users in the OU, then on the ou add the script for that group to the ou group policy.

If you want to get really picky, you can put each user into a seperate OU...which has the net result of associating a username and password with the script........although what circumstances would force you to get that granular, I don't know.

Just put all users who need the same settings in their own OU
net use x: \\server\share /user:domain\testuser password
Last question.  I added the password to the file.  the users do not logon to the domain yet because of network problems that we are having,  but we can map the drive.  Is there anyway to hide the password that  I put into the file so it cannot be viewed?


Randy
Don't think so.  Anybody?
Not without packaging the command in an executable.  NSIS is very easy and I could give you the exact script you would need if this is something you want to persue.
Not Sure what NSIS is,  but if it hides the password I definately would want to pursue it.
ASKER CERTIFIED SOLUTION
Avatar of coopey247
coopey247

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How do I make it so the script pauses for 15 seconds before it actually runs the script?

Make it this:

Section "1"
Sleep 15000
Exec "$SYSDIR .......
SectionEnd

It sleeps in milliseconds, which I'm pretty sure 1000 milliseconds equals one second.

Yep this is what I did and it worked great!