Skip to content

Instantly share code, notes, and snippets.

@darkpixel

darkpixel/login.bat

Created Aug 17, 2015
Embed
What would you like to do?
The worst login file I have ever seen...
This is the worst login file I have ever seen.
I redacted a few things with '---' to protect the identity of the MCP who created it, and the idiots who kept updating it, and the unfortunate client who just ditched them because nothing ever worked right...
REM @echo off
REM universal login batch file
REM Put individual user settings below in the user section.
REM Modified by --- on 5/21/03 for new server
REM Modified by --- on 11/11/03 (added check for term server)
REM Modified by --- on 9/9/008 to reflect fact that server2 is now ntserver.
REM Put global settings in Common section.
REM NOTE: when checking username, be sure to use lower case!
echo Processing login for %username% on %computername%
:: following implemented by group policy
::call \\ntserver\netlogon\audit.cmd LOGIN
:: Drive mappings on TERMINAL3 are implemented by Group Policy.
:: This script has no effect on TERMINAL3.
REM IF /I %username%==joeu goto JoeU
REM IF /I %computername%==TERMINALSERVER goto Term
IF /I %computername%==TERMINAL2 goto Term2
IF /I %computername%==TERMINAL3 goto Terminal3
IF /I %computername%==nt_server goto Supervisor
IF /I %computername%==ntserver goto Supervisor
REM ****************************************************
REM Header section
set idrv=
set lpgrp=
set skiplp1=no
goto %username%
goto common
REM ****************************************************
REM User section
REM idrv is group-share directory.
REM lpgrp is the printer group (up=upstairs, wp=word processing,
REM anx=annex)
:default
set idrv=
set lpgrp=up
goto common
:Administrator
net use q: /delete
net use s: /delete
net use w: /delete
net use z: /delete
net use q: \\fileserver\mas90 /persistent:yes
net use s: \\fileserver\closed /persistent:yes
net use w: \\fileserver\wp51 /persistent:yes
:: net use z: \\fileserver\ws_support
rem install logon sync registry setting so logon script finishes before exploder starts
rem regedit /s t:\admin\lognsync.reg
rem disable opportunistic locking
rem regedit /s t:\admin\opwksdis.reg
rem install Service Pack 6a
rem start \\ntserver\download\sp6a\update\update.exe
rem install VNC remote control
rem if exist c:\progra~1\orl\vnc\vncviewer.exe goto skipvnc
rem start \\ntserver\ws_support\winvnc\setup.exe
rem :skipvnc
` goto common
rem goto end
:Adam
REM set idrv=
REM set lpgrp=anx
goto common
:Alice
set idrv=picommon
set lpgrp=anx
goto common
:Barry
set idrv=common
set lpgrp=upxp
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Bill
set idrv=
set lpgrp=anx
goto common
:Carlene
REM set idrv=
REM set lpgrp=anx
goto common
:Chelsea
REM set idrv=common
REM set lpgrp=wp
goto common
:Darryl
set idrv=
set lpgrp=wp
goto common
:Debbie
set idrv=wpcommon
set lpgrp=wp
net use lpt1: /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1: \\ntserver\color /persistent:yes /USER:debbie debbie
goto common
:joeu
if /I %computername%==TERMINAL2 goto DEFB
set idrv=admincommon
set lpgrp=wp
REM net use o: /delete
REM net use o: \\ntserver\mas90 /persistent:yes
:DEFB
net use q: /delete
net use q: \\fileserver\mas90
if /I %computername%==TERMINAL2 goto Term2
goto common
:Don
set idrv=idcommon
set lpgrp=wp
goto common
:Donna
set idrv=
set lpgrp=anx
goto common
:Frances
set idrv=idcommon
set lpgrp=wp
net use lpt1 /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1 \\ntserver\hpinsdef /persistent:yes
goto common
:Frank
set idrv=escorcommon
set lpgrp=wp
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Frontdesk
set idrv=acctcommon
set lpgrp=
net use lpt2 /delete
net use lpt3 /delete
net use lpt2 \\ntserver\wpgen /persistent:yes
net use lpt3 \\ntserver\wpcorres /persistent:yes
:Geoffrey
REM set idrv=
REM set lpgrp=anx
goto common
:Heidi
set idrv=common
set lpgrp=up
goto common
:Hillary
set idrv=wpcommon
set lpgrp=wp
net use lpt1: /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1: \\ntserver\color /persistent:yes
goto common
:James
set idrv=
set lpgrp=wp
goto common
:Jay
set idrv=
set lpgrp=wp
goto common
:Jane
set idrv=
set lpgrp=wp
goto common
:test
set idrv=
set lpgrp=wp
goto common
:Janet
set idrv=wpcommon
set lpgrp=wp
net use lpt1: /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1: \\ntserver\color /persistent:yes
net use o: /delete
net use r: /delete
net use o: \\fileserver\--- /persistent:yes
net use r: \\fileserver\--- /persistent:yes
goto common
:jill
set idrv=
set lpgrp=wp
goto common
:John
set idrv=picommon
set lpgrp=anx
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Josh
set idrv=
set lpgrp=anxxp
goto common
:Kara
set idrv=idcommon
set lpgrp=up
goto common
:Karen
set idrv=common
set lpgrp=up
goto common
:Kathy
set idrv=escorcommon
net use r: /delete
net use r: \\fileserver\--- /persistent:yes
set lpgrp=up
goto common
:Library
set idrv=
set lpgrp=
set skiplp1=yes
goto common
:Linda
set idrv=wpcommon
set lpgrp=wp
net use lpt1: /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1: \\ntserver\color /persistent:yes
goto common
:Mark
set idrv=idcommon
set lpgrp=up
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Matt
set idrv=common
set lpgrp=wp
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Melinda
set idrv=picommon
set lpgrp=anx
goto common
:Mike
set idrv=escorcommon
set lpgrp=wp
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Nicole
set idrv=
set lpgrp=wp
goto common
:Sally
set idrv=acctcommon
set lpgrp=wp
net use o: /delete
net use q: /delete
:: net use r: /delete
:: net use u: /delete
:: net use y: /delete
:: net use z: /delete
:: net use o: \\ntserver\mas90 /persistent:yes
net use o: \\fileserver\ria /persistent:yes
net use q: \\fileserver\mas90
:: net use r: \\ntserver\sqlbackup$
:: net use y: \\ntserver\backup$ /persistent:yes
:: net use z: \\ntserver\c$ /persistent:yes
goto common
:Sam
set idrv=wpcommon
set lpgrp=wp
goto common
:Sandy
set idrv=admincommon
set lpgrp=wp
REM net use o: /delete
REM net use o: \\ntserver\mas90 /persistent:yes
net use q: /delete
net use q: \\fileserver\mas90
goto common
:Staff
set idrv=idcommon
set lpgrp=wp
goto common
:Supervisor
:: if /I %computername%==NT_SERVER net use q: /delete
:: if /I %computername%==NT_SERVER net use q: \\ntserver\scan$
:: if /I %computername%==NTSERVER net use q: /delete
:: if /I %computername%==NTSERVER net use q: \\fileserver\scan$
:: if /I %computername%==fileserver net use q: /delete
:: if /I %computername%==fileserver net use q: \\fileserver\scan$
goto end
:Training
set idrv=
set lpgrp=wp
goto common
goto common
REM ****************************************************
REM Common section. Global settings go here.
:common
net use f: /delete
net use i: /delete
net use j: /delete
net use l: /delete
net use n: /delete
net use p: /delete
net use s: /delete
net use t: /delete
net use u: /delete
net use w: /delete
net use x: /delete
net use f: \\fileserver\--- /persistent:yes
if defined idrv net use i: \\fileserver\%idrv% /persistent:yes
net use j: \\fileserver\--- /persistent:yes
::net use l: \\fileserver\--- /persistent:yes
net use n: \\fileserver\common /persistent:yes
net use p: \\fileserver\saga /persistent:yes
net use s: \\fileserver\closed /persistent:yes
net use t: \\fileserver\--- /persistent:yes
REM net use u: \\ntserver\--- /persistent:yes
net use w: \\fileserver\wp51 /persistent:yes
::net use x: \\fileserver\--- /persistent:yes
goto %lpgrp%
goto up
REM ******************************************************
REM Printer groups section
:anxxp
net use lpt2 /delete
net use lpt3 /delete
net use lpt2 \\ntserver\wpgen /persistent:yes
net use lpt3 \\ntserver\wpcorres /persistent:yes
goto end
REM Word Processing/Downstairs
:wp
net use lpt2 /delete
net use lpt3 /delete
net use lpt2 \\ntserver\wpgen /persistent:yes
net use lpt3 \\ntserver\wpcorres /persistent:yes
goto end
REM Upstairs
:up
net use lpt1 /delete
net use lpt2 /delete
net use lpt3 /delete
echo IF YOU ARE ASKED FOR A PASSWORD just press Enter
net use lpt1 \\ntserver\hpinsdef /persistent:yes
net use lpt2 \\ntserver\wpgen /persistent:yes
net use lpt3 \\ntserver\wpcorres /persistent:yes
goto end
:upxp
net use lpt2 /delete
net use lpt3 /delete
net use lpt2 \\ntserver\wpgen /persistent:yes
net use lpt3 \\ntserver\wpcorres /persistent:yes
goto end
REM Terminal users just need drive mappings
:Term
reg import c:\ttonly.reg
if /I %username%==karen set idrv=escorcommon
if not exist \\terminalserver\tmtemp\%USERNAME% mkdir \\terminalserver\tmtemp\%USERNAME%
net use * /delete /y
if /I %USERNAME%==joeu net use q: \\fileserver\mas90
net use f: \\fileserver\--- /persistent:yes
if defined idrv net use i: \\fileserver\%idrv% /persistent:yes
net use j: \\fileserver\--- /persistent:yes
::net use l: \\fileserver\--- /persistent:yes
net use n: \\fileserver\common /persistent:yes
net use p: \\fileserver\saga /persistent:yes
net use r: \\fileserver\--- /persistent:yes
::net use s: \\fileserver\msoffice /persistent:yes
net use t: \\fileserver\--- /persistent:yes
REM net use u: \\ntserver\--- /persistent:yes
net use w: \\fileserver\wp51 /persistent:yes
::net use x: \\fileserver\--- /persistent:yes
net use v: \\terminalserver\TMtemp\%username%
:Term2
REM Set Internet Explorer Cache to 50MB
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content" /v CacheLimit /t REG_DWORD /d 0xc800 /f
reg import c:\ttonly.reg
if /I %username%==karen set idrv=escorcommon
if not exist \\terminal2\tmtemp\%USERNAME% mkdir \\terminal2\tmtemp\%USERNAME%
net use * /delete /y
if /I %USERNAME%==joeu net use q: \\fileserver\mas90
if /I %USERNAME%==sally net use q: \\fileserver\mas90
if /I %USERNAME%==matt net use q: \\fileserver\mas90
if /I %USERNAME%==john net use q: \\fileserver\mas90
if /I %USERNAME%==mark net use q: \\fileserver\mas90
if /I %USERNAME%==mike net use q: \\fileserver\mas90
if /I %USERNAME%==nirm net use q: \\fileserver\mas90
if /I %USERNAME%==frank net use q: \\fileserver\mas90
if /I %USERNAME%==barry net use q: \\fileserver\mas90
if /I %USERNAME%==chelsea net use q: \\fileserver\mas90
net use f: \\fileserver\--- /persistent:yes
if defined idrv net use i: \\fileserver\%idrv% /persistent:yes
net use j: \\fileserver\sti /persistent:yes
::net use l: \\fileserver\--- /persistent:yes
net use n: \\fileserver\common /persistent:yes
net use p: \\fileserver\saga /persistent:yes
net use r: \\fileserver\--- /persistent:yes
::net use s: \\fileserver\msoffice /persistent:yes
net use t: \\fileserver\--- /persistent:yes
REM net use u: \\ntserver\--- /persistent:yes
net use w: \\fileserver\wp51 /persistent:yes
::net use x: \\fileserver\--- /persistent:yes
net use v: \\terminal2\TMtemp\%username%
goto end
REM ***********************************************************
:Terminal3
xcopy /Y "\\fileserver\wp51\word templates\normal.dotm" "%appdata%\Microsoft\Templates\"
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment