nt logon scripts
Results 1 to 3 of 3

Thread: nt logon scripts

  1. #1
    Join Date
    Jan 2002
    Posts
    2

    nt logon scripts

    Hello everybody, I need some help setting up a logon script on NT to connect users to a drive on the server, any replies would be greatly appreciated, with examples if possible, thanks.

  2. #2
    Join Date
    Apr 2000
    Location
    London, England
    Posts
    219
    Below is a copy of the Login Script which we use in our company.

    It includes examples of how to map drives, checking permissions before mapping drives, calling regfiles, setting time, using parameters, etc.

    Any queries, post back.

    D.

    @ECHO OFF

    Rem *********

    CLS

    echo Login Script v 3.24

    echo.
    echo Welcome %USERNAME%, Your Log-On was validated by %LOGONSERVER%
    echo.

    Rem Recording the time of the Users Login
    echo Recording Login time information...
    rd \\00-svr-pdc\login$\%username%
    md \\00-svr-pdc\login$\%username%

    Rem Set Server location of Group Files (S: Drive)
    Set %GroupFiles=\\00-SVR-PDC

    Rem Synchronises the time with the clock on the PDC
    ECHO Synchronising PC Clock with Server Time...
    NET TIME \\00-SVR-PDC /SET /Y

    Rem Next four lines were added for V3.12 testing continues....
    IF "%OS%"=="Windows_NT" GOTO WINNT

    REM Win 95/98 drive mappings
    rem CALL
    Echo about to run 95 Mappings
    xcopy \\00-svr-pdc\netlogon\lpc95.bat c:\windows /d

    c:\windows\LPC95.BAT

    GOTO FINSH


    :WINNT
    Rem Establishing Drive Mappings

    ECHO Deleting existing connections...
    Net Use * /d /y

    ECHO Re-establishing Drive Mappings..
    :H_Drive
    ECHO H -- Application Directory
    NET USE H: \\00-SVR-MAIL\APPLICATIONS /P:N>NUL

    :I_Drive
    If not exist \\00-SVR-PDC\D$\*.* goto J_Drive
    ECHO I -- 00-SVR-PDC D: Drive
    NET USE I: \\00-SVR-PDC\D$ /P:N>NUL

    :J_Drive
    If not exist %GroupFiles%\JDEProjects$\*.* goto K_Drive
    ECHO J -- JDE Projects Directory
    NET USE J: %GroupFiles%\JDEProjects$ /P:N>NUL

    :K_Drive
    If not exist \\00-SVR-PDC\KRONOS\*.* goto L_Drive
    ECHO K -- Kronos Time and Attendance
    NET USE K: \\00-SVR-PDC\KRONOS /P:N>NUL

    :L_Drive
    If not exist \\00-SVR-PDC\E$\*.* goto M_Drive
    ECHO L -- PDC D: Drive
    NET USE L: \\00-SVR-PDC\E$ /P:N>NUL

    :M_Drive
    If not exist \\00-SVR-MAIL\D$\*.* goto N_Drive
    ECHO M -- MailServer D: Drive
    NET USE M: \\00-SVR-MAIL\D$ /P:N>NUL

    :N_Drive
    If not exist \\00-SVR-MAIL\E$\*.* goto O_Drive
    ECHO N -- MailServer E: Drive
    NET USE N: \\00-SVR-MAIL\E$ /P:N>NUL

    :O_Drive
    If not exist \\00-SVR-SQL\Regale\*.* goto P_Drive
    ECHO O -- SQL Regale
    NET USE O: \\00-SVR-SQL\Regale /P:N>NUL

    :P_Drive
    ECHO P -- LPC 'System'
    NET USE P: \\00-SVR-PDC\LPCSystem$ /P:N>NUL

    :Q_Drive
    ECHO Q -- LPC 'Costs'
    NET USE Q: \\00-SVR-PDC\LPCCosts$ /P:N>NUL

    :R_Drive
    If not exist \\00-SVR-PDC\Payroll\*.* goto S_Drive
    ECHO R -- Payroll Directory
    NET USE R: \\00-SVR-PDC\PAYROLL /P:N>NUL

    :S_Drive
    ECHO S -- Shared Directory Accessible only to your Group.

    :ITDrive
    If not exist %GroupFiles%\IT$\*.* goto AccsDrive
    Echo You are a member of the IT Department.
    Net use S: %GroupFiles%\IT$ /P:N>NUL
    Set %Dept=IT
    Goto T_Drive

    :AccsDrive
    If not exist %GroupFiles%\Accs$\*.* goto DistDrive
    Echo You are a member of the Finance Department.
    Net use S: %GroupFiles%\Accs$ /P:N>NUL
    Set %Dept=Accs

    If not exist %GroupFiles%\Permissions$\AccsMan\*.* goto FAPAYCHK
    Set %Dept=AccsMan
    Goto T_Drive

    :FAPAYCHK
    If not exist %GroupFiles%\Permissions$\FAPay\*.* goto COSTACCS
    Set %Dept=Fapay
    Goto T_Drive

    :COSTACCS
    If not exist %GroupFiles%\Permissions$\Costaccs\*.* goto T_Drive
    Set %Dept=Costaccs

    Goto T_Drive

    istDrive
    If not exist %GroupFiles%\Dist$\*.* goto ProdContDrive
    Echo You are a member of the Distribution Department.
    Net use S: %GroupFiles%\Dist$ /P:N>NUL
    Set %Dept=Dist
    Goto T_Drive

    :ProdContDrive
    If not exist %GroupFiles%\Production$\*.* goto PersDrive
    Echo You are a member of the Production Controllers Group.
    Net use S: %GroupFiles%\Production$ /P:N>NUL
    Set %Dept=Production
    Goto T_Drive

    :PersDrive
    If not exist %GroupFiles%\Pers$\*.* goto Technical
    Echo You are a member of the Personnel Department.
    Net use S: %GroupFiles%\Pers$ /P:N>NUL
    Set %Dept=Pers
    Goto T_Drive


    :Technical
    If not exist %GroupFiles%\Technical$\*.* goto HASDrive
    Net use S: %GroupFiles%\Technical$ /P:N>NUL

    :NPDDrive
    If not exist %GroupFiles%\Permissions$\Innovations\*.* goto CustCom
    Echo You are a member of New Product Development.
    Set %Dept=NPD
    Goto T_Drive

    :CustCom
    If not exist %GroupFiles%\Permissions$\Custom\*.* goto QCADrive
    Echo You are a member of the Customer Complaints Development.
    Set %Dept=CustCom
    Goto T_Drive

    :QCADrive
    If not exist %GroupFiles%\Permissions$\QCA\*.* goto TechDrive
    Echo You are a member of the Quality Control Auditors Department.
    Set %Dept=QCA
    Goto T_Drive

    :TechDrive
    Echo You are a member of the Technical Group.
    Set %Dept=Technical
    Goto T_Drive


    :HASDrive
    If not exist %GroupFiles%\HAS$\*.* goto ShiftMgrDrive
    Echo You are a member of the Health and Safety Department.
    Net use S: %GroupFiles%\HAS$ /P:N>NUL
    Set %Dept=HAS
    Goto T_Drive

    :ShiftMgrDrive
    If not exist %GroupFiles%\ShiftMgr$\*.* goto SalesDrive
    Net use S: %GroupFiles%\ShiftMgr$ /P:N>NUL
    :Unit03S
    If not exist %GroupFiles%\ShiftMgr$\Unit03\*.* Goto Unit04S
    Echo You are a member of Unit 3 Shift Managers.
    Set %Dept=03S

    :Unit04S
    If not exist %GroupFiles%\ShiftMgr$\Unit04\*.* Goto Unit05S
    Echo You are a member of Unit 4 Shift Managers.
    Set %Dept=04S

    :Unit05S
    If not exist %GroupFiles%\ShiftMgr$\Unit05\*.* Goto Unit40S
    Echo You are a member of Unit 5 Shift Managers.
    Set %Dept=05S

    :Unit40S
    If not exist %GroupFiles%\ShiftMgr$\Unit40\*.* Goto Unit97S
    Echo You are a member of Unit 40 Shift Managers.
    Set %Dept=40S

    :Unit97S
    If not exist %GroupFiles%\ShiftMgr$\Unit97\*.* Goto ShiftDone
    Echo You are a member of Unit 97 Shift Managers.
    Set %Dept=97S

    :SHIFTDONE
    Goto T_Drive

    :SalesDrive
    If not exist %GroupFiles%\Sales$\*.* goto HygieneDrive
    Echo You are a member of the Sales Department.
    Net use S: %GroupFiles%\Sales$ /P:N>NUL
    Set %Dept=Sales
    Goto T_Drive

    :HygieneDrive
    If not exist %GroupFiles%\Hygiene$\*.* goto ReceptionDrive
    Echo You are a member of the Hygiene Department.
    Net use S: %GroupFiles%\Hygiene$ /P:N>NUL
    Set %Dept=Hygiene
    Goto T_Drive

    :ReceptionDrive
    If not exist %GroupFiles%\Reception$\*.* goto NoGroup
    Echo You are a member of the Reception Team.
    Net use S: %GroupFiles%\Reception$ /P:N>NUL
    Set %Dept=Reception
    Goto T_Drive

    :NoGroup
    Echo You are not a member of any Department.
    Set %Dept=N
    Goto T_Drive

    :T_Drive
    :Proxy
    If not exist \\00-svr-proxy\d$\*.* goto EDI
    Echo You are a Member of the Proxy Group
    Net use T: \\00-svr-proxy\d$ /P:N>NUL
    Goto U_Drive

    :EDI
    If not exist \\00-svr-pdc\EDI$\*.* goto Tiras
    Echo You are a Member of the EDI Admins Group
    Net use T: \\00-svr-pdc\EDI$ /P:N>NUL
    Goto U_Drive

    :Tiras
    If not exist %Groupfiles%\Tiras$\*.* goto EngDrive
    Echo You are a Member of the Tiras Group
    Net use T: %GroupFiles%\Tiras$ /P:N>NUL
    Goto U_Drive

    :EngDrive
    If not exist %GroupFiles%\Eng$\*.* goto U_Drive
    Net use T: %GroupFiles%\Eng$ /P:N>NUL
    If exist %GroupFiles%\IT$\*.* goto U_Drive
    If exist %GroupFiles%\ShiftMgr$\*.* goto U_Drive
    If not exist %GroupFiles%\Eng$\Refrig~1\*.* Goto Unit3E
    Echo You are a member of the Refrigeration Engineers Department.
    Set %Dept=Refrig
    Goto EngDone
    :Unit3E
    If not exist %GroupFiles%\Eng$\03Engi~1\*.* Goto Unit40E
    Echo You are a member of the Unit 3 Engineering Department.
    Set %Dept=03E
    Goto EngDone
    :Unit40E
    If not exist %GroupFiles%\Eng$\40Engi~1\*.* Goto Unit97E
    Echo You are a member of the Unit 40 Engineering Department.
    Set %Dept=40E
    Goto EngDone
    :Unit97E
    If not exist %GroupFiles%\Eng$\97Engi~1\*.* Goto purchasing
    Echo You are a member of the Unit 97 Engineering Department.
    Set %Dept=97E
    Goto EngDone
    :Purchasing
    If not exist %GroupFiles%\Permissions$\Purchasing\*.* Goto EngStores
    Echo You are a member of Purchasing.
    Set %Dept=Purchasing
    Goto EngDone
    :EngStores
    If not exist %GroupFiles%\Eng$\Stores\*.* Goto EngDone
    Echo You are a member of Engineering Stores.
    Set %Dept=EngStores
    Goto EngDone
    :ENGDONE
    Goto U_Drive

    :U_Drive
    ECHO U -- Shared Drive Accessable to All Users
    NET USE U: %GroupFiles%\ALL /P:N>NUL

    :V_Drive
    If not exist \\00-SVR-PDC\CDATA$\*.* goto W_Drive
    ECHO V -- C Data Directory
    NET USE V: \\00-SVR-PDC\CDATA$ /P:N>NUL

    :W_Drive
    ECHO W -- J.D. Edwards Documents Directory
    NET USE W: \\00-SVR-PDC\JDEDOCS /P:N>NUL

    :X_Drive
    If not exist \\00-SVR-PDC\Distribution\*.* goto Y_Drive
    ECHO X -- Distribution Directory
    NET USE X: \\00-SVR-PDC\DISTRIBUTION /P:N>NUL

    :Y_Drive
    If not exist \\00-SVR-HD2\DATABASE\*.* goto Z_Drive
    ECHO Y -- Scheduler Directory
    NET USE Y: \\00-SVR-HD2\DATABASE /P:N>NUL

    :Z_Drive
    ECHO Z -- Users own Private Directory
    NET USE Z: \\00-SVR-PDC\%USERNAME%$ /P:N>NUL
    Goto PARAMSET

    :PARAMSET
    Rem Setting the correct Case for the lpc.bat parameters
    Set %P1=Y
    Set %P2=Y
    If "%1"=="" goto UKAS400
    If /I %1==N Set %P1=N
    If "%2"=="" goto UKAS400
    If /I %2==N Set %P2=N
    Goto UKAS400

    :UKAS400
    Rem Configures UK Regional and AS400 Settings.
    Echo Installing your Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\all.reg
    Echo Installing your AS400 settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\as400.reg
    Echo Installing your Mochasoft settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\Mocha.reg
    Goto EMIL

    :EMIL
    IF %P1%==N GOTO PRNTERS
    Rem AutoConfigure EMail Profile for uses Exhcange Server Account,
    Rem Changes with any user.
    Echo.
    Echo Configuring your personalised E-Mail Profile...
    %LOGONSERVER%\NetLogon\Email\PROFGEN %LOGONSERVER%\NetLogon\Email\NEWPROF.EXE -P %LOGONSERVER%\NetLogon\Email\EMAIL.PRF -R
    Echo The operation completed successfully.
    Goto PRNTERS

    :PRNTERS
    IF %P2%==N GOTO NO_PRINTERS
    Rem Configuring Printers
    Echo.
    Echo Removing existing Printer Settings...
    %LOGONSERVER%\Netlogon\Regfiles\REG DELETE HKCU\Printers\ /FORCE
    Echo Removing existing Printer versions...
    %LOGONSERVER%\Netlogon\Regfiles\REG DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices" /FORCE
    Echo Installing your AS400, Printer and Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\%Dept%.reg
    GOTO DELTMP

    :NO_PRINTERS
    Rem Configures UK Regional and AS400 Settings.
    Echo Installing your AS400 and Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\n.reg
    GOTO DELTMP

    ELTMP
    Echo Deleting Temporary files...
    del C:\temp\*.tmp /Q
    del C:\temp\~*.* /Q
    GOTO ZAC

    :ZAC
    rem Echo Running ZAC inventory agent...
    rem \\00-svr-helpdesk\mcafeesm\siteinv\agent\equip32 /SW /HW /NOSHOW
    Goto REMMGA

    :REMMGA
    reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MGA Hook" /FORCE
    reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MGA QuickDesk" /FORCE
    Goto LaptopBU

    :LaptopBU
    Echo Checking for Laptop Backup...
    If not exist \\00-SVR-MAIL\%Username%$\*.* goto FINSH
    Echo Performing Laptop Backup...
    XCOPY C:\Mydocu~1 \\00-svr-mail\%username%$ /D /E /V /C /K /Q /Exclude:%LOGONSERVER%\NetLogon\exclude.txt
    GOTO FINSH

    :FINSH

  3. #3
    Join Date
    Jan 2002
    Posts
    2
    Originally posted by Dwharf:
    Below is a copy of the Login Script which we use in our company.

    It includes examples of how to map drives, checking permissions before mapping drives, calling regfiles, setting time, using parameters, etc.

    Any queries, post back.

    D.

    @ECHO OFF

    Rem *********

    CLS

    echo Login Script v 3.24

    echo.
    echo Welcome %USERNAME%, Your Log-On was validated by %LOGONSERVER%
    echo.

    Rem Recording the time of the Users Login
    echo Recording Login time information...
    rd \\00-svr-pdc\login$\%username%
    md \\00-svr-pdc\login$\%username%

    Rem Set Server location of Group Files (S: Drive)
    Set %GroupFiles=\\00-SVR-PDC

    Rem Synchronises the time with the clock on the PDC
    ECHO Synchronising PC Clock with Server Time...
    NET TIME \\00-SVR-PDC /SET /Y

    Rem Next four lines were added for V3.12 testing continues....
    IF "%OS%"=="Windows_NT" GOTO WINNT

    REM Win 95/98 drive mappings
    rem CALL
    Echo about to run 95 Mappings
    xcopy \\00-svr-pdc\netlogon\lpc95.bat c:\windows /d

    c:\windows\LPC95.BAT

    GOTO FINSH


    :WINNT
    Rem Establishing Drive Mappings

    ECHO Deleting existing connections...
    Net Use * /d /y

    ECHO Re-establishing Drive Mappings..
    :H_Drive
    ECHO H -- Application Directory
    NET USE H: \\00-SVR-MAIL\APPLICATIONS /P:N>NUL

    :I_Drive
    If not exist \\00-SVR-PDC\D$\*.* goto J_Drive
    ECHO I -- 00-SVR-PDC D: Drive
    NET USE I: \\00-SVR-PDC\D$ /P:N>NUL

    :J_Drive
    If not exist %GroupFiles%\JDEProjects$\*.* goto K_Drive
    ECHO J -- JDE Projects Directory
    NET USE J: %GroupFiles%\JDEProjects$ /P:N>NUL

    :K_Drive
    If not exist \\00-SVR-PDC\KRONOS\*.* goto L_Drive
    ECHO K -- Kronos Time and Attendance
    NET USE K: \\00-SVR-PDC\KRONOS /P:N>NUL

    :L_Drive
    If not exist \\00-SVR-PDC\E$\*.* goto M_Drive
    ECHO L -- PDC D: Drive
    NET USE L: \\00-SVR-PDC\E$ /P:N>NUL

    :M_Drive
    If not exist \\00-SVR-MAIL\D$\*.* goto N_Drive
    ECHO M -- MailServer D: Drive
    NET USE M: \\00-SVR-MAIL\D$ /P:N>NUL

    :N_Drive
    If not exist \\00-SVR-MAIL\E$\*.* goto O_Drive
    ECHO N -- MailServer E: Drive
    NET USE N: \\00-SVR-MAIL\E$ /P:N>NUL

    :O_Drive
    If not exist \\00-SVR-SQL\Regale\*.* goto P_Drive
    ECHO O -- SQL Regale
    NET USE O: \\00-SVR-SQL\Regale /P:N>NUL

    :P_Drive
    ECHO P -- LPC 'System'
    NET USE P: \\00-SVR-PDC\LPCSystem$ /P:N>NUL

    :Q_Drive
    ECHO Q -- LPC 'Costs'
    NET USE Q: \\00-SVR-PDC\LPCCosts$ /P:N>NUL

    :R_Drive
    If not exist \\00-SVR-PDC\Payroll\*.* goto S_Drive
    ECHO R -- Payroll Directory
    NET USE R: \\00-SVR-PDC\PAYROLL /P:N>NUL

    :S_Drive
    ECHO S -- Shared Directory Accessible only to your Group.

    :ITDrive
    If not exist %GroupFiles%\IT$\*.* goto AccsDrive
    Echo You are a member of the IT Department.
    Net use S: %GroupFiles%\IT$ /P:N>NUL
    Set %Dept=IT
    Goto T_Drive

    :AccsDrive
    If not exist %GroupFiles%\Accs$\*.* goto DistDrive
    Echo You are a member of the Finance Department.
    Net use S: %GroupFiles%\Accs$ /P:N>NUL
    Set %Dept=Accs

    If not exist %GroupFiles%\Permissions$\AccsMan\*.* goto FAPAYCHK
    Set %Dept=AccsMan
    Goto T_Drive

    :FAPAYCHK
    If not exist %GroupFiles%\Permissions$\FAPay\*.* goto COSTACCS
    Set %Dept=Fapay
    Goto T_Drive

    :COSTACCS
    If not exist %GroupFiles%\Permissions$\Costaccs\*.* goto T_Drive
    Set %Dept=Costaccs

    Goto T_Drive

    istDrive
    If not exist %GroupFiles%\Dist$\*.* goto ProdContDrive
    Echo You are a member of the Distribution Department.
    Net use S: %GroupFiles%\Dist$ /P:N>NUL
    Set %Dept=Dist
    Goto T_Drive

    :ProdContDrive
    If not exist %GroupFiles%\Production$\*.* goto PersDrive
    Echo You are a member of the Production Controllers Group.
    Net use S: %GroupFiles%\Production$ /P:N>NUL
    Set %Dept=Production
    Goto T_Drive

    :PersDrive
    If not exist %GroupFiles%\Pers$\*.* goto Technical
    Echo You are a member of the Personnel Department.
    Net use S: %GroupFiles%\Pers$ /P:N>NUL
    Set %Dept=Pers
    Goto T_Drive


    :Technical
    If not exist %GroupFiles%\Technical$\*.* goto HASDrive
    Net use S: %GroupFiles%\Technical$ /P:N>NUL

    :NPDDrive
    If not exist %GroupFiles%\Permissions$\Innovations\*.* goto CustCom
    Echo You are a member of New Product Development.
    Set %Dept=NPD
    Goto T_Drive

    :CustCom
    If not exist %GroupFiles%\Permissions$\Custom\*.* goto QCADrive
    Echo You are a member of the Customer Complaints Development.
    Set %Dept=CustCom
    Goto T_Drive

    :QCADrive
    If not exist %GroupFiles%\Permissions$\QCA\*.* goto TechDrive
    Echo You are a member of the Quality Control Auditors Department.
    Set %Dept=QCA
    Goto T_Drive

    :TechDrive
    Echo You are a member of the Technical Group.
    Set %Dept=Technical
    Goto T_Drive


    :HASDrive
    If not exist %GroupFiles%\HAS$\*.* goto ShiftMgrDrive
    Echo You are a member of the Health and Safety Department.
    Net use S: %GroupFiles%\HAS$ /P:N>NUL
    Set %Dept=HAS
    Goto T_Drive

    :ShiftMgrDrive
    If not exist %GroupFiles%\ShiftMgr$\*.* goto SalesDrive
    Net use S: %GroupFiles%\ShiftMgr$ /P:N>NUL
    :Unit03S
    If not exist %GroupFiles%\ShiftMgr$\Unit03\*.* Goto Unit04S
    Echo You are a member of Unit 3 Shift Managers.
    Set %Dept=03S

    :Unit04S
    If not exist %GroupFiles%\ShiftMgr$\Unit04\*.* Goto Unit05S
    Echo You are a member of Unit 4 Shift Managers.
    Set %Dept=04S

    :Unit05S
    If not exist %GroupFiles%\ShiftMgr$\Unit05\*.* Goto Unit40S
    Echo You are a member of Unit 5 Shift Managers.
    Set %Dept=05S

    :Unit40S
    If not exist %GroupFiles%\ShiftMgr$\Unit40\*.* Goto Unit97S
    Echo You are a member of Unit 40 Shift Managers.
    Set %Dept=40S

    :Unit97S
    If not exist %GroupFiles%\ShiftMgr$\Unit97\*.* Goto ShiftDone
    Echo You are a member of Unit 97 Shift Managers.
    Set %Dept=97S

    :SHIFTDONE
    Goto T_Drive

    :SalesDrive
    If not exist %GroupFiles%\Sales$\*.* goto HygieneDrive
    Echo You are a member of the Sales Department.
    Net use S: %GroupFiles%\Sales$ /P:N>NUL
    Set %Dept=Sales
    Goto T_Drive

    :HygieneDrive
    If not exist %GroupFiles%\Hygiene$\*.* goto ReceptionDrive
    Echo You are a member of the Hygiene Department.
    Net use S: %GroupFiles%\Hygiene$ /P:N>NUL
    Set %Dept=Hygiene
    Goto T_Drive

    :ReceptionDrive
    If not exist %GroupFiles%\Reception$\*.* goto NoGroup
    Echo You are a member of the Reception Team.
    Net use S: %GroupFiles%\Reception$ /P:N>NUL
    Set %Dept=Reception
    Goto T_Drive

    :NoGroup
    Echo You are not a member of any Department.
    Set %Dept=N
    Goto T_Drive

    :T_Drive
    :Proxy
    If not exist \\00-svr-proxy\d$\*.* goto EDI
    Echo You are a Member of the Proxy Group
    Net use T: \\00-svr-proxy\d$ /P:N>NUL
    Goto U_Drive

    :EDI
    If not exist \\00-svr-pdc\EDI$\*.* goto Tiras
    Echo You are a Member of the EDI Admins Group
    Net use T: \\00-svr-pdc\EDI$ /P:N>NUL
    Goto U_Drive

    :Tiras
    If not exist %Groupfiles%\Tiras$\*.* goto EngDrive
    Echo You are a Member of the Tiras Group
    Net use T: %GroupFiles%\Tiras$ /P:N>NUL
    Goto U_Drive

    :EngDrive
    If not exist %GroupFiles%\Eng$\*.* goto U_Drive
    Net use T: %GroupFiles%\Eng$ /P:N>NUL
    If exist %GroupFiles%\IT$\*.* goto U_Drive
    If exist %GroupFiles%\ShiftMgr$\*.* goto U_Drive
    If not exist %GroupFiles%\Eng$\Refrig~1\*.* Goto Unit3E
    Echo You are a member of the Refrigeration Engineers Department.
    Set %Dept=Refrig
    Goto EngDone
    :Unit3E
    If not exist %GroupFiles%\Eng$\03Engi~1\*.* Goto Unit40E
    Echo You are a member of the Unit 3 Engineering Department.
    Set %Dept=03E
    Goto EngDone
    :Unit40E
    If not exist %GroupFiles%\Eng$\40Engi~1\*.* Goto Unit97E
    Echo You are a member of the Unit 40 Engineering Department.
    Set %Dept=40E
    Goto EngDone
    :Unit97E
    If not exist %GroupFiles%\Eng$\97Engi~1\*.* Goto purchasing
    Echo You are a member of the Unit 97 Engineering Department.
    Set %Dept=97E
    Goto EngDone
    :Purchasing
    If not exist %GroupFiles%\Permissions$\Purchasing\*.* Goto EngStores
    Echo You are a member of Purchasing.
    Set %Dept=Purchasing
    Goto EngDone
    :EngStores
    If not exist %GroupFiles%\Eng$\Stores\*.* Goto EngDone
    Echo You are a member of Engineering Stores.
    Set %Dept=EngStores
    Goto EngDone
    :ENGDONE
    Goto U_Drive

    :U_Drive
    ECHO U -- Shared Drive Accessable to All Users
    NET USE U: %GroupFiles%\ALL /P:N>NUL

    :V_Drive
    If not exist \\00-SVR-PDC\CDATA$\*.* goto W_Drive
    ECHO V -- C Data Directory
    NET USE V: \\00-SVR-PDC\CDATA$ /P:N>NUL

    :W_Drive
    ECHO W -- J.D. Edwards Documents Directory
    NET USE W: \\00-SVR-PDC\JDEDOCS /P:N>NUL

    :X_Drive
    If not exist \\00-SVR-PDC\Distribution\*.* goto Y_Drive
    ECHO X -- Distribution Directory
    NET USE X: \\00-SVR-PDC\DISTRIBUTION /P:N>NUL

    :Y_Drive
    If not exist \\00-SVR-HD2\DATABASE\*.* goto Z_Drive
    ECHO Y -- Scheduler Directory
    NET USE Y: \\00-SVR-HD2\DATABASE /P:N>NUL

    :Z_Drive
    ECHO Z -- Users own Private Directory
    NET USE Z: \\00-SVR-PDC\%USERNAME%$ /P:N>NUL
    Goto PARAMSET

    :PARAMSET
    Rem Setting the correct Case for the lpc.bat parameters
    Set %P1=Y
    Set %P2=Y
    If "%1"=="" goto UKAS400
    If /I %1==N Set %P1=N
    If "%2"=="" goto UKAS400
    If /I %2==N Set %P2=N
    Goto UKAS400

    :UKAS400
    Rem Configures UK Regional and AS400 Settings.
    Echo Installing your Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\all.reg
    Echo Installing your AS400 settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\as400.reg
    Echo Installing your Mochasoft settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\Mocha.reg
    Goto EMIL

    :EMIL
    IF %P1%==N GOTO PRNTERS
    Rem AutoConfigure EMail Profile for uses Exhcange Server Account,
    Rem Changes with any user.
    Echo.
    Echo Configuring your personalised E-Mail Profile...
    %LOGONSERVER%\NetLogon\Email\PROFGEN %LOGONSERVER%\NetLogon\Email\NEWPROF.EXE -P %LOGONSERVER%\NetLogon\Email\EMAIL.PRF -R
    Echo The operation completed successfully.
    Goto PRNTERS

    :PRNTERS
    IF %P2%==N GOTO NO_PRINTERS
    Rem Configuring Printers
    Echo.
    Echo Removing existing Printer Settings...
    %LOGONSERVER%\Netlogon\Regfiles\REG DELETE HKCU\Printers\ /FORCE
    Echo Removing existing Printer versions...
    %LOGONSERVER%\Netlogon\Regfiles\REG DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices" /FORCE
    Echo Installing your AS400, Printer and Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\%Dept%.reg
    GOTO DELTMP

    :NO_PRINTERS
    Rem Configures UK Regional and AS400 Settings.
    Echo Installing your AS400 and Regional settings...
    Regedit /S %LOGONSERVER%\NetLogon\Regfiles\n.reg
    GOTO DELTMP

    ELTMP
    Echo Deleting Temporary files...
    del C:\temp\*.tmp /Q
    del C:\temp\~*.* /Q
    GOTO ZAC

    :ZAC
    rem Echo Running ZAC inventory agent...
    rem \\00-svr-helpdesk\mcafeesm\siteinv\agent\equip32 /SW /HW /NOSHOW
    Goto REMMGA

    :REMMGA
    reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MGA Hook" /FORCE
    reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MGA QuickDesk" /FORCE
    Goto LaptopBU

    :LaptopBU
    Echo Checking for Laptop Backup...
    If not exist \\00-SVR-MAIL\%Username%$\*.* goto FINSH
    Echo Performing Laptop Backup...
    XCOPY C:\Mydocu~1 \\00-svr-mail\%username%$ /D /E /V /C /K /Q /Exclude:%LOGONSERVER%\NetLogon\exclude.txt
    GOTO FINSH

    :FINSH
    Thanks for the great example, it works a treat, and I'm sure that the rest of the script will come in handy, thanks again for a speedy and extensive reply.

    markandsan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •