michaeli
Fresh Scripter
Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
|
OK, I am just going to post the script entirely here and the let you guys have a look at it. Anything you'll can do to help, I'm all ears. Yes I know the code is a bit cavemanish but, I've been trying to teach myself.... The script does work correctly, but I'm sure is not very graceful in motion...
Here it is: ------------------------------------------------------------------------------- ; DOADMIN.KIX ; ; Logon Script for SUSD ; ; ; ; ; Script Author: Michael Ingrando ; Date: 10-21-05 ; ;------- OVERWRITE THIS SECTION TO KEEP THE LAST KNOWN EDITOR CURRENT ------- ; ; Last Modified by: ; Date: ; ;DEBUG ON ;(Uncomment for debugging feature) ; ;------------------------ CANCEL SCRIPT IF SERVER --------------------------- ; IF @wksta = "ADM-DC1" OR @wksta = "ADM-PRT" OR @wksta = "ADMIN-DO" OR @wksta = "ADM-GHT" OR @wksta = "ADMIN" OR @wksta = "ADMIN-IT" OR @wksta = "ADMININET" OR @wksta = "HMSQ" ; COOKIE1 EXIT ENDIF ; ; ;--------------------- PROGRESS DIALOG BOX PRESENTED ------------------------ ; CLS SMALL $TopLeftRow = 0 $TopLeftCol = 0 $BtmRtRow = 30 ;Height $BtmRtCol = 80 ;Width ; Color c/c BOX($TopLeftRow, $TopLeftCol, $BtmRtRow, $BtmRtCol, SINGLE) ; Color r/c+ AT(10, 10) "Please Standby While Network Resources are Established..." Sleep 1 ; Color n/c AT(13,18) "Reviewing User Account Information.........." Sleep 1 ; ; ; ;------------------------------ SET VARIBLES -------------------------------- ; ****** Notice: Always put quotes around all strings. ****** ; $AMN ="\\ADMIN" $ADO ="\\ADMIN-DO" $ADG ="\\ADM-GHT" $DC1 ="\\ADM-DC1" $AIN ="\\ADMININET" $PRT ="\\ADM-PRT" $ITS ="\\ADMIN-IT" $HSQ ="\\HMSQ" ; $Common = $AMN + "\Common" $Apps = $AMN + "\Apps" $Nurses = $HSQ + "\Nurses$" $Itshare = $ITS + "\It-Share$" $FOOD = $AMN + "\Food Services$" ; ;----------- SET GROUPSHARE VARIABLE (Based on group membership.) ----------- ; DEFAULT $GroupShare to NOGROUP$ to prevent script from crashing on assumed variable! ; (THE EFFECT OF MULTIPLE MEMBERSHIP IS THE LAST MAPPING TAKES PRECEDENCE.) ; $GroupShare = $AMN + "\NOGROUP$" ; ; IF INGROUP ("Business & Finance") $GroupShare= $AMN + "\Business & Finance$" ENDIF ; IF INGROUP ("Career Ladder") $GroupShare= $AMN + "\Career Ladder$" ENDIF ; IF INGROUP ("Curriculum") $GroupShare= $AMN + "\Curriculum & Instruction$" ENDIF ; IF INGROUP ("Domain Admins") $GroupShare= $ITS + "\Infotech$" ENDIF ; IF INGROUP ("Educational Services") $GroupShare= $AMN + "\Educational Services$" ENDIF ; IF INGROUP ("Food Services") $GroupShare= $AMN + "\Food Services$" ENDIF ; IF INGROUP ("INFOTECH") $GroupShare= $ITS + "\InfoTech$" ENDIF ; IF INGROUP ("Language Aquisition") $GroupShare= $AMN + "\Language Aquisition$" ENDIF ; ;IF INGROUP ("Leadership Developement") $GroupShare= $AMN + "\Leadership Developement$" ENDIF ; IF INGROUP ("MAINTENANCE") $GroupShare= $AMN + "\Maintenance$" ENDIF ; IF INGROUP ("MultiMedia Services") $GroupShare= $AMN + "\MultiMedia Services$" ENDIF ; IF INGROUP ("Native American Edu") $GroupShare= $AMN + "\Native American Edu$" ENDIF ; IF INGROUP ("Operations") $GroupShare= $AMN + "\Curriculum & Instruction$" ENDIF ; IF INGROUP ("Personnel Services") $GroupShare= $AMN + "\Personnel Services$" ENDIF ; IF INGROUP ("Public Relations") $GroupShare= $AMN + "\Public Relations$" ENDIF ; IF INGROUP ("Purchasing Property Control") $GroupShare= $AMN + "\Purchasing Property Control$" ENDIF ; IF INGROUP ("Research Evaluation") $GroupShare= $AMN + "\Research Evaluation$" ENDIF ; IF INGROUP ("Special Services") $GroupShare= $AMN + "\Special Services$" ENDIF ; IF INGROUP ("Staff Development") $GroupShare= $AMN + "\Staff Development$" ENDIF ; IF INGROUP ("Student Services") $GroupShare= $AMN + "\Student Services$" ENDIF ; IF INGROUP ("Superintendent") $GroupShare= $AMN + "\Superintendent$" ENDIF ; IF INGROUP ("Title I") $GroupShare= $AMN + "\Title I$" ENDIF ; IF INGROUP ("TRANSPORTATION") $GroupShare= $AMN + "\TRANSPORTATION$" ENDIF ; ; ;------------------ CONTINUE PREVIOUS PROGRESS DIALOG BOX ------------------- ; AT(16,22) "Thank You, Login will continue....." Sleep 1 CLS ; ;---------------------------- MAP GLOBAL DRIVES ----------------------------- ; Color n/c AT (1,14) "Mapping District Standard Global Network Drives......" SLEEP 1 ; ;----------- MAP STANDARD DRIVES FOR ALL SITES (Global Mappings) ------------ ; USE F: $Apps ; USE G: $GroupShare ; USE I: $Common ; IF INGROUP ("Nurses") USE N: $Nurses ENDIF ; IF INGROUP ("Domain Admins") USE O: $Itshare ENDIF ; IF INGROUP ("Food Services") USE W: $Food ENDIF ; ; ; ;------- THE NEXT MAPPINGS PORTION OF THE SCRIPT IS UNIQUE TO THE SITE ------ ; ;----------------------------- MAP LOCAL DRIVES ----------------------------- ; Color n/c AT (3,14) "Mapping Site-Based Local Network Drives.............." SLEEP 1 ; ; ;------------------ MAP SITE OR APPLICATION SPECIFIC DRIVES ----------------- ; ;IF INGROUP ("Domain Users") USE M: ENDIF ; ; ;-------------------------- MAP CDROM TOWER DRIVES -------------------------- ;------------------------ (NOT IN USE AT THIS TIME) ------------------------- ; ; ;------------------ END UNIQUE MAPPINGS PORTION OF SCRIPT ------------------- ; ; ; ;------------------------------- CHECK UPDATES ------------------------------ ; Color n/c AT (5,14) "Checking for Updates and Configuration Changes......." SLEEP 1 ; ;----------------------- CREATE UPDATES IN THIS SECTION --------------------- ; ;----------------------- REGISTRY MODIFICATION SECTION ---------------------- ; ;---------------------------- UPDATES COMPLETED ----------------------------- ; Color n/c AT (7,14) "Updates and Configuration Changes Completed.........." SLEEP 1 ; ;-------------------------- DISPLAY USER SETTINGS --------------------------- ; SMALL Color g+/n BOX (10,14,18,66,FULL) Color w+/n AT ( 11,20)"Userid : " ; User Login Information Window Text Strings AT (12,20) "Full name : " AT (13,20) "Privilege : " AT (14,20) "Workstation : " AT (15,20) "Domain : " AT (16,20) "Logon Server : " AT (17,20) "Script Used : " Color y+/n AT ( 11,37) @userid ; Associated Macro's AT (12,37) @fullname AT (13,37) @priv AT (14,37) @wksta AT (15,37) @domain AT (16,37) @lserver AT (17,37) @scriptname sleep 3 ; ; ;--------------------- CONFIRM GLOBALLY MAPPED DRIVES ---------------------- ; Color n/c AT (21,14) "Verifying Globally Mapped Network Drive Connections..." SLEEP 1 ; ; ;---------------------- MAPPED DRIVE ERROR CHECKING ------------------------- ; ;USE L: /DELETE ;(FOR DEBUGGING) ; $DL="F:\" IF EXIST ("F:\") GOSUB "CHECKG" ELSE GOTO "ERROR" ENDIF ; :CHECKG $DL="G:\" IF EXIST ("G:\") GOSUB "CHECKG2" ELSE GOTO "ERROR" ENDIF ; :CHECKG2 ;fnMapped("\\ADMIN\NOGROUP$") ? ;(Uncomment to echo drive letter output to window.) IF fnMapped("\\ADMIN\NOGROUP$") <> "G:" GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF ; :CHECKH $DL="H:\" IF EXIST ("H:\") GOSUB "CHECKI" ELSE GOTO "ERROR" ENDIF ; :CHECKI $DL="I:\" IF EXIST ("I:\") GOSUB "LOGON" ELSE GOTO "ERROR" ENDIF ; ; ;---------------------- MESSAGE BOX PROMPTED TO USER ------------------------ ; :MISDIRECT BEEP MESSAGEBOX ("Your login to the SUSD Network has reported an error." + CHR(10) + "Some network resources may not be available." + CHR(10) + "Your $DL network drive to security group association has failed." + CHR(10) + "Please report this to your I.T. Department." + CHR(10) + "Your account has been validated by @LSERVER." + CHR(10) + "The time is @DAY, @TIME, @DATE." + CHR(10) + " Have a nice day ;o) !!" + CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Association Failed ", 48, 15) GOSUB "END" ; :ERROR BEEP MESSAGEBOX ("Your login to the SUSD Network has reported an error." + CHR(10) + "Some network resources may not be available." + CHR(10) + "Your $DL network drive did not acquire a connection." + CHR(10) + "Please report this to your I.T. Department." + CHR(10) + "Your account has been validated by @LSERVER." + CHR(10) + "The time is @DAY, @TIME, @DATE." + CHR(10) + " Have a nice day ;o) !!" + CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Missing", 48, 15) GOSUB "END" ; ; ; ; :LOGON MESSAGEBOX ("Welcome to the Sunnyside USD Computer Network." + CHR(10) + "Your account has been validated by @LSERVER." + CHR(10) + "The time is @DAY, @TIME, @DATE." + CHR(10) + " Have a nice day ;o) !!!", "Sunnyside USD #12 - LOGIN SUCCESSFUL !!!", 64, 15) ; :END ;----------- TELLS THE SCRIPT INTERPRETER THAT THE SCRIPT IS DONE ----------- COOKIE1 EXIT ; ;--------------------------- UDF DEFINITIONS -------------------------------- ;------------------------------ fnMapped ------------------------------------ ; Function fnMapped($sUNC) Dim $oDrives,$oDrive $oDrives = CreateObject("Scripting.FileSystemObject").Drives If Not VarType($oDrives) & 9 Exit 1 EndIf For Each $oDrive in $oDrives If $oDrive.DriveType = 3 AND $sUNC = $oDrive.ShareName $fnMapped = $oDrive.DriveLetter + ":" EndIf Next EndFunction
|