Discussion Locked

log on bat.

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need an example of a generic logon bat. file. I am running a data base the needs a mapped networked drive, but I want to restrick the users from changing or manipulating these mapped drives. I would like this bat. file to run these mapped drivesin the start up.

thanks mike

6 replies

by duskos

I would try following:

REM First we delete mapping if it alredy exists
net use x: /delete
REM now we map drive x: to \\server\share
net use x: \\server\share

Place the script in \\server\netlogon
Set permissions so that domain users can read the file and domain amins can have full control of the file.

Change user's account properties so that the script is executed at logon time.
Hint. If you have Windows 9x computers, name the file LOGON.BAT (not LOGON.CMD), otherwise the script would not execute on Windows 9x.

Some more info about scripts can be found in Windows NT Resource Kit. Consider using kixtart.

by joseph moore

Ok. Here is one I made for sys admins. Due to length, this is in 2 parts:

@ECHO OFF

rem ***************************************************
rem SysAdmin login script sys.bat
rem Changes applied June 7, 2001
rem ***************************************************

rem ***************************************************
rem Delete all drive mappings that this script will map
rem ***************************************************

net use f: /delete
net use s: /delete
net usey: /delete
net use i: /delete
NET USE L: /DELETE

rem ***************************************************
rem Map network drives
rem All drives map with the persistent:no switch
rem ***************************************************

net use F: \\SERVER1\ROOT /persistent:no
net use S: \\SERVER1\SHARE /persistent:no
net use Y: \\SERVER2\PUBLIC /persistent:no
net use I: "\\SERVER1\SYS&OPS" /persistent:no
NET USE L: \\SERVER3\LICENSES$ /PERSISTENT:NO

rem ***************************************************
rem Printer LPT1 Port Mapping
rem ***************************************************

net use lpt1: \\CHMSNTP01\HP4V /persistent:no

rem **************************************************
rem Set Up Pathing
rem **************************************************

path=%path%;f:\;

by joseph moore

Part 2 (don't include this line in BAT file)

rem **************************************************
rem Optional Section
rem Items here will be run for a while then removed
rem **************************************************

if %username% == JOE goto SpecialDriveMap
if %username% == joe goto SpecialDriveMap
goto end

:SpecialDriveMap
cls
echo Mapping drive P to the Special machine. Please stand by.
net use P: \\10.1.1.25\special /persistent:no /user:domain2\special_user specialpasswd
goto end

rem The above checks the login name and sees if it is one of a couple of logins.
rem Yes, it is case sensitive in this situation.
rem IF there is a match, then it will map
rem drive P to the Special machine. Otherwise, it won't

rem **************************************************
rem End Optional Section
rem **************************************************

EXIT

rem **Changes applied by Joseph Moore

:end

Hope that helps

This discussion is closed to new replies.