Home All Groups Group Topic Archive Search About

login script in win2k domain



Author
9 Aug 2005 5:52 PM
Rob
i have a bat file that runs for non admin users that maps printers and
drives, it first disconnects all drives and then reconnects.
my problem is, its failing to map some drives sometimes. i cant seem to
figure out why it would work sometimes and not others.

any help would be great.

thanks

--
Rob
MCP

Author
9 Aug 2005 11:51 PM
Marty List
Show quote
"Rob" <rfr***@mscu.com> wrote in message
news:Z6adnZaTw9fycGXfRVn-vQ@golden.net...
> i have a bat file that runs for non admin users that maps printers and
> drives, it first disconnects all drives and then reconnects.
> my problem is, its failing to map some drives sometimes. i cant seem to
> figure out why it would work sometimes and not others.
>
> any help would be great.
>
> thanks
>
> --
> Rob
> MCP


How can we help without seeing the script or the error codes/error message that
it fails with???
Author
10 Aug 2005 8:11 PM
Rob
@echo off
REM ********** Check Machine's Operating System   ********************
ver | find "Windows XP" >nul
if not errorlevel 1 set NTVersion=Windows XP&goto CheckRole
ver | find "Windows 2000" >nul
if not errorlevel 1 set NTVersion=Windows 2000&goto CheckRole
ver | find "Windows NT" >nul
if not errorlevel 1 Set NTVersion=Windows NT&goto CheckRole
echo   OS version not compatible...
goto end


:CheckRole
REM ********** Check Machine's Role PDC/BDC/Wkstn ********************
for /f "skip=8 Tokens=3" %%i in ('net accounts') do if /i NOT
"%%i"=="completed" set Role=%%i
If /i "%Role%"=="WORKSTATION" goto Workstation
echo %NTVersion% %Role%, exiting login script
goto END

:WORKSTATION
REM ********** Begin Standard Workstation Login   ********************
echo %NTVersion% %Role% login
echo.
echo Please wait while your login completes
echo.

REM
****************************************************************************
*
REM **  XCOPY Probe*.INI files to users system     *
REM
****************************************************************************
*
xcopy \\ms433s02\rfsnt\bin\probe_ini\Probe.INI %windir% /Y
xcopy \\ms433s02\rfsnt\bin\probe_ini\ProbeNV.INI %windir% /Y
xcopy \\ms433s02\rfsnt\bin\lmhosts\LMHOSTS.
%windir%\system32\drivers\etc\*.* /Y
nbtstat -R



REM ********** Remove all mapped drives except Y: ********************
for /f "skip=6 tokens=2" %%j in ('net use') do if not "%%j"=="command" if
not "%%j"=="Y:" net use /d %%j
CON2PRT /F

REM ********** Check the Machine's IP Address     ********************
For /F "Skip=1 Tokens=1,2,3* Delims=[] " %%a in ('@ping -n 1
%computername%') do if /i "%%a"=="Pinging" set IPadd=%%c
For /f "Tokens=3 Delims=." %%d in ('@echo %IPadd%') do set octet3=%%d
IF "%octet3%"=="2" SET Server=\\S-KIT-01&GOTO Kit
IF "%octet3%"=="3" SET Server=\\MS303S01&GOTO Ayl
IF "%octet3%"=="8" SET Server=\\S-MIL-01&GOTO Mil
IF "%octet3%"=="11" SET Server=\\S-LEA-01&GOTO Lea
IF "%octet3%"=="12" SET Server=\\S-ELM-01&GOTO Elm
IF "%octet3%"=="13" SET Server=\\S-NEW-01&GOTO New
IF "%octet3%"=="32" SET Server=\\S-WAT-01&GOTO Wat
IF "%octet3%"=="33" SET Server=\\S-HOF-DC2&GOTO HOF
IF "%ComputerName:~2,3%"=="KIT" SET Server=\\S-KIT-01&GOTO Kit
IF "%ComputerName:~2,3%"=="AYL" SET Server=\\MS303S01&GOTO Ayl
IF "%ComputerName:~2,3%"=="MIL" SET Server=\\S-MIL-01&GOTO Mil
IF "%ComputerName:~2,3%"=="LEA" SET Server=\\S-Lea-01&GOTO Lea
IF "%ComputerName:~2,3%"=="ELM" SET Server=\\S-ELM-01&GOTO Elm
IF "%ComputerName:~2,3%"=="NEW" SET Server=\\S-NEW-01&GOTO New
IF "%ComputerName:~2,3%"=="WAT" SET Server=\\S-WAT-01&GOTO Wat
IF "%ComputerName:~2,3%"=="HOF" SET Server=\\S-HOF-DC2&GOTO HOF
IF "%ComputerName:~0,5%"=="MODEL" SET Server=\\S-HOF-DC2&GOTO HOF
GOTO END

:HOF
REM **********  Head Office                       ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: \\10.17.33.202\RFSNT
ECHO Mapping S: Drive
NET USE S: \\S-HOF-DC2\data
ECHO Mapping T: Drive
NET USE T: \\S-HOF-REP01\Reports
IF EXIST C:\ACC.TXT con2prt /C \\W-HOF-18\DeskReps
if /I "%username%"=="twagler" NET USE U: \\TRAINING\UnderstandCU
CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
CON2PRT /C \\S-HOF-DC2\DocuCentre555pcl /C \\S-HOF-DC2\REPSdn
CON2PRT /C \\S-HOF-DC2\HP4100 /C \\S-HOF-DC2\REPSup
CON2PRT /C \\S-HOF-DC2\HP2100mkt /C \\S-HOF-DC2\REPSmtd
CON2PRT /C \\S-HOF-DC2\HP2300LNS /C \\S-HOF-DC2\LNSREPS

ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: \\S-HOF-DC2\HP4000DN
IF EXIST C:\LOCAL.TXT CON2PRT /C \\S-HOF-DC2\HP4100 /C \\S-HOF-DC2\HP4000dn
/C \\S-HOF-DC2\HP4300mtd
IF EXIST C:\DOWN.TXT IF NOT EXIST C:\LOCAL.TXT IF NOT EXIST C:\LOANS.TXT
CON2PRT /CD \\S-HOF-DC2\HP4000dn /C \\S-HOF-DC2\HP4100 /C
\\S-HOF-DC2\HP4300mtd
IF EXIST C:\TRAIN.TXT CON2PRT /C \\S-HOF-DC2\HP4100 /C \\S-HOF-DC2\HP4000dn
/CD \\S-HOF-DC2\HP4300mtd
IF EXIST C:\LOANS.TXT CON2PRT /C \\S-HOF-DC2\HP4100 /C \\S-HOF-DC2\HP4000dn
/CD \\S-HOF-DC2\HP2300LNS /C \\S-HOF-DC2\LNSREPS
IF NOT EXIST C:\LOCAL.TXT IF NOT EXIST C:\DOWN.TXT IF NOT EXIST C:\TRAIN.TXT
IF NOT EXIST C:\LOANS.TXT CON2PRT /CD \\S-HOF-DC2\HP4100 /C
\\S-HOF-DC2\HP4000dn  /C \\S-HOF-DC2\HP4300mtd
IF /I "%COMPUTERNAME:~5,5%"=="TRAIN" GOTO Training
GOTO RFS_Word

:Training
REM **********  Training                          ********************
ECHO Mapping U: Drive
NET USE U: \\TRAINING\UnderstandCU
ECHO Copying CU Training Program
copy U:\asym.ini C:\winnt
if "%NTVersion%"=="Windows NT" copy U:\"Understanding the credit union
system.lnk" C:\winnt\profiles\%USERNAME%\"Start Menu"\
if "%NTVersion%"=="Windows 2000" copy U:\"Understanding the credit union
system.lnk" C:\"Documents and Settings"\%USERNAME%\"Start Menu"\
GOTO RFS_Word

:Ayl
REM **********  Aylmer                            ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: \\MS%Server:~4,3%S01\RFSNT
CON2PRT /C \\S-WAT-01\HP4000
CON2PRT /CD \\AB303W01\HP2200
CON2PRT /C  \\AB303W01\REPS
GOTO RFS_Word

:Elm
REM **********  Elmira                            ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: %Server%\RFSNT
ECHO Mapping S: Drive
NET USE S: %Server%\data
CON2PRT /C %Server%\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH /C
%SERVER%\RICOH1018
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: %Server%\HP4000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C %Server%\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C %Server%\HP4000
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
%Server%\HP4000
GOTO RFS_Word

:Kit
REM **********  Kitchener                         ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: %Server%\RFSNT
ECHO Mapping S: Drive
NET USE S: %Server%\data
CON2PRT /C %Server%\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: %Server%\HP4000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C %Server%\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C %Server%\HP4000
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
%Server%\HP4000
GOTO RFS_Word

:Lea
REM **********  Leamington                        ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: %Server%\RFSNT
ECHO Mapping S: Drive
NET USE S: %Server%\data
CON2PRT /C %Server%\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: %Server%\HP4000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C %Server%\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C %Server%\HP4000 /CD %Server%\HP2200
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
%Server%\HP4000
CON2PRT /C %Server%\REPS2200
If Not Exist C:\BACK.TXT CON2PRT /C %Server%\HP2200
GOTO RFS_Word

:Mil
REM **********  Milverton                         ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: %Server%\RFSNT
ECHO Mapping S: Drive
NET USE S: %Server%\data
CON2PRT /C %Server%\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: %Server%\HP4000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C %Server%\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C %Server%\HP4000
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
%Server%\HP4000
CON2PRT /C %Server%\REPS2200
If Not Exist C:\BACK.TXT CON2PRT /C %Server%\HP2200
IF EXIST C:\BACK.TXT CON2PRT /CD %Server%\HP2200
GOTO RFS_Word

:New
REM **********  New Hamburg                       ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: \\S-NEW-01\RFSNT
ECHO Mapping S: Drive
NET USE S: \\s-new-01\data
CON2PRT /C \\s-new-01\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: \\s-new-01\HP40000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C \\s-new-01\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C \\s-new-01\HP4000
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
\\s-new-01\HP4000
CON2PRT /C \\s-new-01\REPS2200
If Not Exist C:\BACK.TXT CON2PRT /C \\s-new-01\HP2200
IF EXIST C:\BACK.TXT CON2PRT /CD \\s-new-01\HP2200
GOTO RFS_Word

:Wat
REM **********  Waterloo                          ********************
ECHO.
ECHO Mapping R: Drive
NET USE R: %Server%\RFSNT
ECHO Mapping S: Drive
NET USE S: %Server%\Data
CON2PRT /C %Server%\REPS4000 /C %Server%\RICOH2022 /C %Server%\REPSRICOH
ECHO.
ECHO Mapping LPT2: Printer Port
NET USE LPT2: %Server%\HP4000
IF EXIST C:\COLOUR.TXT CON2PRT /C \\S-HOF-DC2\DocuColour2240pcl
IF EXIST C:\LOCAL.TXT CON2PRT /C %Server%\HP4000
IF EXIST C:\BACK.TXT CON2PRT /C %Server%\HP4000
IF NOT EXIST C:\BACK.TXT IF NOT EXIST C:\LOCAL.TXT CON2PRT /CD
%Server%\HP4000
GOTO RFS_Word

:RFS_Word
REM ********** Copy Word Macros Files   ********************
ECHO.
ECHO Mapping K: Drive
NET USE K: \\S-HOF-DC2\clic
ECHO Mapping X: Drive
NET USE X: \\S-HOF-DC2\LargeCashTrans
if exist C:\"Program Files"\"Microsoft Office"\Office10\Startup attrib -h
C:\"Program Files"\"Microsoft Office"\Office10\Startup\*.*
if exist C:\"Program Files"\"Microsoft Office"\Office10\Startup del /q
C:\"Program Files"\"Microsoft Office"\Office10\Startup\*.*
if exist C:\"Program Files"\"Microsoft Office"\Office10\Startup ECHO Copying
MSCU Word Macros& copy %Server%\NETLOGON\MSCUmacrosXP2.dot c:\"Program
Files"\"Microsoft Office"\Office10\Startup
if exist C:\"Program Files"\"Microsoft Office"\Office11\Startup attrib -h
C:\"Program Files"\"Microsoft Office"\Office11\Startup\*.*
if exist C:\"Program Files"\"Microsoft Office"\Office11\Startup del /q
C:\"Program Files"\"Microsoft Office"\Office11\Startup\*.*
if exist C:\"Program Files"\"Microsoft Office"\Office11\Startup ECHO Copying
MSCU Word Macros& copy %Server%\NETLOGON\MSCUmacrosXP2.dot c:\"Program
Files"\"Microsoft Office"\Office11\Startup

rem ********************************************************************
rem *** Copies New Production Icon to All Users Desktop & Start Menu ***
rem ********************************************************************
if exist C:\"Documents and Settings"\"All Users"\"Start
Menu"\Programs\"rfsnt Banking" rmdir /q /s C:\"Documents and Settings"\"All
Users"\"Start Menu"\Programs\"rfsnt Banking"
if exist C:\"Documents and Settings"\%UserName%\"Start Menu"\Programs\"rfsnt
Banking" rmdir /q /s C:\"Documents and Settings"\%UserName%\"Start
Menu"\Programs\"rfsnt Banking"
if exist C:\"Documents and Settings"\%username%\"Desktop"\"RFS-NT
Banking.lnk" del /y C:\"Documents and Settings"\%username%\"Desktop"\"RFS-NT
Banking.lnk"
xcopy  \\10.17.33.202\rfsnt\Bin\utilities\WS_Icons\ADC_Production\"RFS-NT
Banking.lnk" C:\"Documents and Settings"\"All Users"\"Start Menu"\ /Y
xcopy  \\10.17.33.202\rfsnt\Bin\utilities\WS_Icons\ADC_Production\"RFS-NT
Banking.lnk" C:\"Documents and Settings"\"All Users"\Desktop\ /Y

REM ********** Check for Payroll **********
IF EXIST C:\PAYROLL.TXT GOTO PAYROLL
REM ********** SETUP TECNICOST DRIVES **********
ECHO Mapping W: Drive
NET USE W: \\S-HOF-RFS\los_data
ECHO Mapping L: Drive
IF "%octet3%"=="33" (NET USE L: \\S-HOF-RFS\los_data) ELSE (NET USE L:
%server%\los_data)
ECHO Mapping P: Drive
IF "%octet3%"=="33" (NET USE P: \\S-HOF-RFS\LOS_%username%) ELSE (NET USE P:
%server%\LOS_%username%)
GOTO END

:PAYROLL
REM ********* Map Drives Needed to run Payroll App **************
ECHO Mapping P: Drive
NET USE P: \\S-HOF-BACKUP\Payroll
ECHO Mapping O: Drive
NET USE o: \\S-HOF-BACKUP\Report_Smith


:END



--
Rob
MCP


Show quote
"Marty List" <use***@optimumx.com> wrote in message
news:%23QNuL1TnFHA.1048@tk2msftngp13.phx.gbl...
>
> "Rob" <rfr***@mscu.com> wrote in message
> news:Z6adnZaTw9fycGXfRVn-vQ@golden.net...
> > i have a bat file that runs for non admin users that maps printers and
> > drives, it first disconnects all drives and then reconnects.
> > my problem is, its failing to map some drives sometimes. i cant seem to
> > figure out why it would work sometimes and not others.
> >
> > any help would be great.
> >
> > thanks
> >
> > --
> > Rob
> > MCP
>
>
> How can we help without seeing the script or the error codes/error message
that
> it fails with???
>
>
>
Author
10 Aug 2005 8:35 PM
Marty List
Oh, that's much more clear now.  The problem is on line 306.
Author
11 Aug 2005 8:11 PM
Rob
thanks for that Marty!


--
Rob
MCP


Show quote
"Marty List" <use***@optimumx.com> wrote in message
news:%23BwoKsenFHA.1416@TK2MSFTNGP09.phx.gbl...
>
> Oh, that's much more clear now.  The problem is on line 306.
>
>
>
Author
11 Aug 2005 9:55 PM
Marty List
I would like to help, but you haven't provided any info.  This would be like
taking your car to a mechanic and saying "my car works sometimes and sometimes
it doesn't, what could be wrong?

All of the standard troubleshooting would apply, for example:

When it fails -
- What error number/error message does the logon script display?
- Are there any related event log entries on the client during this time?
- Are there any related event log entries on the server during this time?
- Is it always on the same client machines?
- Is the client always on the same OS/service pack combination?
- Is it always when connecting to the same share or printer?
- Is it always around the same time of day? (heavy load during morning logons,
backup or other processes are running, etc.)

Name resolution is always a suspect.  Make sure these clients can resolve the
server name by DNS, specifically nslookup.exe servername.  Make sure they are
not getting a differnet IP address from WINS resolution (nblookup.exe
servername).  As a test, you could modify the logon script to use the server's
IP address instead, if it never fails this way you might be on to something.
Author
15 Aug 2005 1:47 PM
Rob
thank you, ill look into it a little deeper and get back to you if i have
some questions.



--
Rob
MCP


Show quote
"Marty List" <use***@optimumx.com> wrote in message
news:e4s3U9rnFHA.2904@tk2msftngp13.phx.gbl...
>
> I would like to help, but you haven't provided any info.  This would be
like
> taking your car to a mechanic and saying "my car works sometimes and
sometimes
> it doesn't, what could be wrong?
>
> All of the standard troubleshooting would apply, for example:
>
> When it fails -
> - What error number/error message does the logon script display?
> - Are there any related event log entries on the client during this time?
> - Are there any related event log entries on the server during this time?
> - Is it always on the same client machines?
> - Is the client always on the same OS/service pack combination?
> - Is it always when connecting to the same share or printer?
> - Is it always around the same time of day? (heavy load during morning
logons,
> backup or other processes are running, etc.)
>
> Name resolution is always a suspect.  Make sure these clients can resolve
the
> server name by DNS, specifically nslookup.exe servername.  Make sure they
are
> not getting a differnet IP address from WINS resolution (nblookup.exe
> servername).  As a test, you could modify the logon script to use the
server's
> IP address instead, if it never fails this way you might be on to
something.
>
>
>

AddThis Social Bookmark Button