Viewing blog post - Greg's Tech blog
Logon script
| Posted by gmartin on Thu 27 of March, 2008 22:58 EDT |
More on the corporate logon script.
So here's the final script. There is a lot going on because we're trying to think ahead and be prepared for various user needs. I will note that this isn't based soley on our thoughts and current needs. We based this on something from one staffers previous job. Had we started from scratch, we would have a slightly ligher script, but would invest more time later solving problems.
There are calls to several external scripts
setdrive.cmd
IsServerOS.vbs
GroupMatch.vbs
These scripts are documented elsewhere in this blog
As with all this, use it if it helps.
\\Greg
So here's the final script. There is a lot going on because we're trying to think ahead and be prepared for various user needs. I will note that this isn't based soley on our thoughts and current needs. We based this on something from one staffers previous job. Had we started from scratch, we would have a slightly ligher script, but would invest more time later solving problems.
@ECHO OFF :: ******************************************************************************* :: This is the default Somecorp Windows Login batch file. :: Modifications :: 3/17/08 GjM Original script :: 3/26/08 GjM Moved personal script to end; cleanup :: 3/26/08 GjM Added setdrive.cmd to unmap then remap drives :: 3/26/08 GjM Added test to see if were logging into a server. :: ******************************************************************************* :: Change title of window for NT machines TITLE somecorp DOMAIN LOGON SCRIPT (%LOGONSERVER%) echo Please wait while your logon is processed... :: ******************************************************************************* :: ********************* Set a temporary path for executables. ************************ :: ********************* Used only during logon process. ************************* SET PATH=\somecorp.com\sysvol\somecorp.com\scripts\bin;%PATH% SET LOGONBIN=\somecorp.com\sysvol\somecorp.com\scripts\bin SET USERLOGONBIN=\somecorp.com\sysvol\somecorp.com\scripts\users :: Test to see if we should run this script cscript /nologo %LOGONBIN%\Groupcheck.vbs "MigratedUsers" if %errorlevel% EQU 0 ( echo Failed groupcheck, exiting... Goto :EOF ) :: Test to see if we are on a server and shouldn't run cscript /nologo %LOGONBIN%\IsServerOS.vbs if %errorlevel% EQU 0 ( echo Running on a server; skipping logon script! Goto :EOF ) goto Main :MAIN :: ******************************************************************************* :: **************** Look for LOGONSERVER and reset if necessary ****************** :: **************** This may be necessary if user logins in off net and joins later :: **************** Ex: mobile user VPNS and runs script to map drives *********** :: Check for LOGONSERVER var reset for logon process if necessary for remote access :: if NOT '%LOGONSERVER%'=='\%COMPUTERNAME%' goto SKIPSERVERSET :: SET LOGONSERVER=\DC01 :: CScript %LOGONBIN%\RegWrite.vbs "HKEY_CURRENT_USER\Volatile Environment\LOGONSERVER" \server REG_SZ :SKIPSERVERSET :: ********************************************************** :: Map Corporate shares call setdrive H \somecorp.com\Corp\All_HomeDIR\%username% call setdrive I \somecorp.com\Corp call setdrive J \somecorp.com\Tech call setdrive K \somecorp.com\Prod :: ********************* Look for and run personal logon script ****************** :: @echo Checking for Personal Logon script... If exist %USERLOGONBIN%\%username%.cmd ( @echo Found personal login script call %USERLOGONBIN%\%username%.cmd ) ::A real personal login script... ::This is a Netadmin secret (shhh!) @if exist c:\local\mylogon.bat call c:\local\mylogon.bat :: ******************************************************************************* :: ************** Inventory Plus REMd out on 013001 by bsc *************** :: echo %DATE% %TIME% "Starting Inventory Select: " /n :: INVselect.vbs abcdefg :: ******************************************************************************** :: **************************** Launch homepage ******************************** ::************************** Added 03/22/02 BSC ******************************** ::start http://www.somecorp.com
There are calls to several external scripts
setdrive.cmd
IsServerOS.vbs
GroupMatch.vbs
These scripts are documented elsewhere in this blog
As with all this, use it if it helps.
\\Greg
| Permalink |
|






