Click here to return to the KiXtart HelpDesk main page...

KiXtart Script Depot

Advanced Network Logon Script

; REM ***********************************************************************
; REM **
; REM ** FILE NAME: NetworkLogin.KIX
; REM ** LOCATION : \NETLOGON\SCRIPTS
; REM ** DEVELOPER: Robert Butler - rbutler@kodak.com
; REM ** PURPOSE  : Automate some client and admin tasks, as well as enforce
; REM **            some Kodak system standards.  Displays security and
; REM **            logging message.  Syncs time of local computer with logon
; REM **            server.  Maps user's home and project directories.
; REM **            Verify the local client network configuration, as well as
; REM **            keep anti-virus signatures up-to-date.
; REM ** REVISIONS: See separate file DomainUser.ChangeLog for script
; REM **            revision history.
; REM **
; REM ***********************************************************************



; REM ** Establish variables, constants.

$SysDrive = (SUBSTR(%windir%,1,2))                ; REM ** Where is the OS installed?  Win95/98 don't support %SystemDrive%
$AcceptKey = "B"                                  ; REM ** Key pressed to accept Security Warning Message
$AdminEmail = "123456N@@mailserver"               ; REM ** Where to send all of the warning messages
$AdminEmail2 = "123456N@@mailserver"              ; REM ** Second email address for CC on warning messages
$DaysSince1970 = ((((@YEAR - 1970) * 365) + @YDAYNO) + ((@YEAR - 1972) / 4)) ; REM ** Quick function to count the number of days since 1970.  Used for some date checks in the script.
$DebugFile = "$SysDrive\@LDOMAIN\Debug.Log"       ; REM ** Location of the script debug log
$DisplayWarning = "No"                            ; REM ** Do we need to show the Security Warning message
$EmailMessage = " "                               ; REM ** Message sent to the $AdminEmail address
$ErrorNumber = 0                                  ; REM ** Holder for Kix32 Error number
$ErrorString = " "                                ; REM ** Holder for Kix32 Error string
$INIFile = "$SysDrive\@LDOMAIN\@LDOMAIN.INI"      ; REM ** INI file used for script settings and event checking
$MailServer = "mailserver"                        ; REM ** POP3 mail server
$OS = "UnKnown"                                   ; REM ** What OS is the client system?
$Privilege = "User"                               ; REM ** User's priviledge level
$Reboot = "No"                                    ; REM ** Reason for rebooting the user's computer
$Row = 4                                          ; REM ** What row to place the cursor on
$Status = " "                                     ; REM ** Reused throughout the script for status messages
$TempKey = " "                                    ; REM ** Used to capture key pressed during Security Message
$TempNumber = 0                                   ; REM ** Reused throughout the script for several functions
$TempString = " "                                 ; REM ** Reused throughout the script for several functions
$UserEmail = " "                                  ; REM ** User's email address


; REM ***********************************************************************
; REM **
; REM **  Begin execution at the main() function at the bottom of the script
; REM ** file.  Sue me, I still have this habit from old 'c' classes. :^)
; REM **
; REM ***********************************************************************

GOTO Main


:DisplayError
; REM ***********************************************************************
; REM **
; REM **  Display an error box on the local screen, and send a message to
; REM ** one of the NT administrators to let him know.  Depending on the
; REM ** number of errors occured, you may want to remark out the
; REM ** 'SENDMESSAGE' line or it could be annoying.
; REM **
; REM ***********************************************************************

  BEEP
  $ErrorNumber = @ERROR
  $ErrorString = @SERROR
  MESSAGEBOX ("$ErrorNumber : $ErrorString", "Script Processing Error.  A system administrator has been notified.", 4144, 30)
  $EmailMessage = "Script Processing Error $ErrorNumber ($ErrorString) occured at @TIME while @FULLNAME was logging in from @WKSTA."
  $Dummy = WRITELINE (10, $EmailMessage + CHR(13) + CHR(10))
  GOSUB SendAdminMail
RETURN


:GetDebugInfo
; REM ************************************************************************
; REM **
; REM **  Extra info about the client system.
; REM **
; REM ************************************************************************

$TempString =
"KiX Information ----------------------------" + CHR(13) + CHR(10) +
"KiX Version         : @KIX" + CHR(13) + CHR(10) +
"KiX RPC Server      : @RSERVER" + CHR(13) + CHR(10) + 
"Script Directory    : @SCRIPTDIR" + CHR(13) + CHR(10) +
"Start Dir for KiX   : @STARTDIR" + CHR(13) + CHR(10) +
"Network Information ------------------------" + CHR(13) + CHR(10) +
"Logon Domain        : @LDOMAIN" + CHR(13) + CHR(10) +
"Logon Server        : @LSERVER" + CHR(13) + CHR(10) +
"Logon Drive Ltr     : @LDRIVE" + CHR(13) + CHR(10) +
"Computer Name       : @WKSTA" + CHR(13) + CHR(10) +
"IP Hostname         : @HOSTNAME" + CHR(13) + CHR(10) +
"IP Address #1       : @IPADDRESS0" + CHR(13) + CHR(10) +
"           #2       : @IPADDRESS1" + CHR(13) + CHR(10) +
"           #3       : @IPADDRESS2" + CHR(13) + CHR(10) +
"           #4       : @IPADDRESS3" + CHR(13) + CHR(10) +
"Ethernet Address    : @ADDRESS" + CHR(13) + CHR(10) +
"Client Information -------------------------" + CHR(13) + CHR(10) +
"Logon Name          : @USERID" + CHR(13) + CHR(10) +
"Users Name          : @FULLNAME" + CHR(13) + CHR(10) +
"Operating System    : $OS" + CHR(13) + CHR(10) +
"O/S Version         : @DOS" + CHR(13) + CHR(10) +
"OS Root Directory   : %SYSTEMROOT%" + CHR(13) + CHR(10) +
"Local User Access   : $Privilege" + CHR(13) + CHR(10) +
"Password Age        : @PWAGE Days" + CHR(13) + CHR(10) +
"User Profile Path   : %USERPROFILE%" + CHR(13) + CHR(10)
RETURN


:SendAdminMail
; REM ************************************************************************
; REM **
; REM **  Used to send email to the NT Administrator defined in $AdminEmail.
; REM ** Attaches a copy of the local $DebugFile to the message so we can see
; REM ** if there's a history of problems on the machine.
; REM **
; REM **  Interprets the user's email address from their logon name.  Both
; REM ** logon names as well as email addresses are based on the employee's
; REM ** insurance (employee) number.
; REM **
; REM ************************************************************************

  GOSUB GetDebugInfo
  $UserEmail = (SUBSTR(@USERID,LEN(@USERID)-5,6)) + "N@@" + $MailServer
  RUN "POSTIE.exe -host:$MailServer -to:$AdminEmail -cc:$AdminEmail2 -from:$UserEmail -s:Logon_Script_Error_on_@WKSTA -msg:" + CHR(34) + "$TempString $EmailMessage" + CHR(34) + " -q -a:$DebugFile"
RETURN


:RandomKey
; REM ************************************************************************
; REM **
; REM **  Used to generate a "random" $AcceptKey.
; REM **
; REM ************************************************************************

  SRND (VAL(SUBSTR(@TIME, 7, 2)) * 1000)
  $AcceptKey = CHR((RND (25)) + 65)
RETURN


:DrawHeaderBox
; REM ***********************************************************************
; REM **
; REM **  Draw header box at top of screen.  The color used to draw the screen
; REM ** changes depending on the user's privilege level.
; REM **
; REM ***********************************************************************

  SELECT
    CASE ($DisplayWarning = "Yes") OR ($Privilege = "Domain Admin")
      COLOR w+/r
    CASE $Privilege = "Local Admin"
      COLOR w+/g
    CASE 1
      COLOR w+/b
  ENDSELECT
  CLS
  BOX (0,0,2,79,DOUBLE)
  $TempString = "@LDOMAIN Windows NT Domain"
  AT (1,(39 - (LEN($TempString) / 2))) $TempString
RETURN


:VerifyInitialSetup
; REM ***********************************************************************
; REM **
; REM **  This routine verifies that the local computer has the '@LDOMAIN'
; REM ** directory created on it.  This directory is used to store debugging
; REM ** information, as well as configuration information.
; REM **  This routine also opens the debug log file, so it is possible to
; REM ** trace through the log and see where (if) the script fails.
; REM **  Checks to see what OS the client is running.
; REM **  In addition, the script checks to see if you have ever seen the
; REM ** security warning / logging message (on a new system setup for
; REM ** instance), or if it is the 1st day of the month.
; REM **  Finally, this script checks to see if you are a member of the
; REM ** 'Domain Admins' group and sets the '$Privilege' variable
; REM ** accordingly.
; REM **
; REM ***********************************************************************

  IF (EXIST ($INIFile) <> 1)
    MD "$SysDrive\@LDOMAIN"
    IF @Error <> 0
      SENDMESSAGE ("S0123456", "Could not create @LDOMAIN directory on @WKSTA.  Please check immediately!")
      SENDMESSAGE ("S0123456", "Could not create @LDOMAIN directory on @WKSTA.  Please check immediately!")
      SENDMESSAGE ("S0123456", "Could not create @LDOMAIN directory on @WKSTA.  Please check immediately!")
      MESSAGEBOX ("There is an error in your system configuration that is preventing you from being logged onto the network succesfully.  Please contact IS&C support for assistance.","Notice",4112)
    ENDIF
    $DisplayWarning = "Yes"
  ENDIF
  $Dummy = OPEN (10, $DebugFile, 5)
  $Dummy = WRITELINE (10, "*** Debug Log Started @TIME @DATE." + CHR(13) + CHR(10))
  $Dummy = WRITELINE (10, "@FULLNAME logged in as @USERID." + CHR(13) + CHR(10))
  SELECT
    CASE ((@INWIN = 1) AND (@DOS = 5.0))     ; REM ** What OS are we running?
      $OS = "Win2K"
    CASE ((@INWIN = 1) AND (@DOS = 4.0))
      $OS = "WinNT4"
    CASE ((@INWIN = 2) AND (@DOS >= 4.10))
      $OS = "Win98"
    CASE ((@INWIN = 2) AND (@DOS = 4.0))
      $OS = "Win95"
  ENDSELECT

  IF ($DisplayWarning = "No") ; REM ** Should we really show the security message?
    IF (@MDAYNO = 1)
      IF (READPROFILESTRING ($INIFile, "LastSeen", "SecurityMessage") <> $DaysSince1970)
        $DisplayWarning = "Yes"
      ENDIF
    ELSE
      IF (($DaysSince1970 - READPROFILESTRING ($INIFile, "LastSeen", "SecurityMessage")) >= 90)
        $DisplayWarning = "Yes"
      ENDIF
    ENDIF
  ENDIF
  SELECT ; REM ** What is the user's privilege level?
    CASE INGROUP("Domain Admins")
      $Privilege = "Domain Admin"
    CASE INGROUP("\\@WKSTA\Administrators")
      $Privilege = "Local Admin"
    CASE INGROUP("\\@WKSTA\Power Users")
      $Privilege = "Power User"
    CASE 1
      $Privilege = "User"
  ENDSELECT
RETURN


:DrawSecurityBox
; REM ***********************************************************************
; REM **
; REM **  Display security information box to local user, as well as make a
; REM ** copy on their local system.
; REM **
; REM ***********************************************************************

  AT (5,8) "UNAUTHORIZED USE MAY RESULT IN CIVIL AND/OR CRIMINAL PROSECUTION"
  AT (7,4) "This is a private computing system for use only by authorized users."
  AT (8,2) "Unless you have been specifically authorized access to this system, your"
  AT (9,2) "continued access may expose you to criminal and/or civil procedings."
  AT (11,4) "Your use of this system, and all information or communications stored or"
  AT (12,2) "transmitted on it by you, with or without authority, or in excess of your"
  AT (13,2) "authority, is subject to review, monitoring, and recording by system"
  AT (14,2) "personnel, without notice or permission.  Any information or data thus"
  AT (15,2) "obtained by system personnel also is subject to review by law enforcement"
  AT (16,2) "and judicial officials in connection with the investigation or prosecution"
  AT (17,2) "of possible criminal activity involving the system."
  AT (19,4) "If you now continue use of the system, you expressly consent to these"
  AT (20,2) "conditions of use."
  GOSUB RandomKey
  SLEEP 3
  BOX (22,0,24,78,SINGLE)
  AT (23,18) "Press -< "
  COLOR w+/r+
  AT (23,27) "$AcceptKey"
  COLOR w+/r
  AT (23,28) " >- to Acknowledge This Information."
  FLUSHKB
  $Dummy = SETCONSOLE ("FOREGROUND")
  DO
    GET $TempKey
  UNTIL UCASE($TempKey) = $AcceptKey
; REM ** Create 'hardcopy' of warning on local computer.
  $TempString = "$SysDrive\@LDOMAIN\Security.Txt"
  IF (EXIST ($TempString) = 1)
    IF OPEN (1, $TempString, 4) = 0
      $Dummy = WRITELINE (1, "@FULLNAME (@USERID) Re-Acknowledged Information at @TIME on @DATE." + CHR(13) + CHR(10))
      $Dummy = CLOSE (1)
    ELSE
      GOSUB DisplayError
    ENDIF
  ELSE
    IF (OPEN (1, $TempString, 5) = 0)
      $Dummy = WRITELINE (1, "@LDOMAIN Windows NT Domain" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "UNAUTHORIZED USE MAY RESULT IN CIVIL AND/OR CRIMINAL PROSECUTION" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "This is a private computing system for use only by authorized users." + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "Unless you have been specifically authorized access to this system, your" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "continued access may expose you to criminal and/or civil procedings." + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "Your use of this system, and all information or communications stored or" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "transmitted on it by you, with or without authority, or in excess of your" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "authority, is subject to review, monitoring, and recording by system" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "personnel, without notice or permission.  Any information or data thus" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "obtained by system personnel also is subject to review by law enforcement" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "and judicial officials in connection with the investigation or prosecution" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "or possible criminal activity involving the system." + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "If you now continue use of the system, you expressly consent to these" + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "conditions of use." + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, "This message was last displayed to @FULLNAME (@USERID) at @TIME on @DATE." + CHR(13) + CHR(10))
      $Dummy = WRITELINE (1, CHR(13) + CHR(10))
      $Dummy = CLOSE (1)
    ELSE
      GOSUB DisplayError
    ENDIF
  ENDIF
  $Dummy = WRITEPROFILESTRING ($INIFile, "LastSeen", "SecurityMessage", "$DaysSince1970")
  $Dummy = WRITELINE (10, "Displayed Security / Logging Warning Message to @FULLNAME (@USERID)." + CHR(13) + CHR(10))
  $DisplayWarning = "No"
RETURN


:SyncTime
; REM ***********************************************************************
; REM **
; REM **  Syncronize the local system time with the logon server.  The PDC
; REM ** server DOM01 syncronizes with NTP server gatekeeper.kodak.com in
; REM ** Rochester, and then acts as an NTP server to BDC DOM02-DOM04 itself.
; REM **  The NT servers must be set in the registry to act as a time server
; REM ** for the NT workstations, otherwise this won't work.
; REM **
; REM ***********************************************************************

  IF ((($OS = "WinNT4") OR ($OS = "Win2K")) AND ($Privilege = "User")))
    $Dummy = WRITELINE (10, "User does not have permissions to set local clock." + CHR(13) + CHR(10))
    RETURN
  ENDIF
  SETTIME @LSERVER
  IF (@ERROR <> 0)
    GOSUB DisplayError
    $Status = " Error  "
  ELSE
    $Dummy = WRITELINE (10, "Syncronized local time with logon server." + CHR(13) + CHR(10))
    $Status = " " + CHR(251) + " OK   "
  ENDIF
RETURN


:CheckDNS
; REM ***********************************************************************
; REM **
; REM **  Checks to make sure that the DNS settings are correct.  If they are
; REM ** found to be incorrect the script edits the registery to insert the 
; REM ** correct values.  If the script has problems doing so (general error,
; REM ** user dosen't have rights to modify the registry, etc.) a message
; REM ** is sent to the system administrators alerting them to this fact.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $DNS = " "

; REM ** Checks to see which Control Set is Current
  IF ($OS = "WinNT4")
    $TempNumber = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\Select", "Current")
    $TempString = "ControlSet00"+$TempNumber
  ENDIF

; REM ** Finds the DNS Server Settings
  SELECT
    CASE $OS = "WinNT4"
      $DNS = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "NameServer")
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $DNS = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer")
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT     

; REM ** Checks the DNS Settings and updates if necessary
  SELECT
    CASE $OS = "WinNT4"
      IF $DNS = "192.168.149.98 192.168.149.99"
        $Dummy = WRITELINE (10, "Verified DNS Settings." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Information: $DNS" + CHR(13) + CHR(10))
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "NameServer", "192.168.149.98 192.168.149.99", "REG_SZ")
          $Reboot = "DNS"
          $Dummy = WRITELINE (10, "Updated DNS Settings." + CHR(13) + CHR(10))
          $Status = "Updated "
        ELSE
          $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Settings.  The current settings are $DNS.  Please correct the settings on this system."
          GOSUB SendAdminMail
          $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
          MESSAGEBOX ("Your DNS settings are INCORRECT but could not be changed automatically.  A systems administrator has been notified of the problem.","Notice",4144)
          $Status = "Skipped "
        ENDIF
      ENDIF
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      IF $DNS = "192.168.149.98,192.168.149.99"
        $Dummy = WRITELINE (10, "Verified DNS Settings." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Information: $DNS" + CHR(13) + CHR(10))
        $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer", "192.168.149.98,192.168.149.99", "REG_SZ")
        $Reboot = "DNS"
        $Dummy = WRITELINE (10, "Updated DNS Settings." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT
RETURN


:CheckDNSDomain
; REM ***********************************************************************
; REM **
; REM **  Checks to make sure that DNS domain setting is correct.  If
; REM ** incorrect, the script edits the registery to insert the 
; REM ** correct value.  If the script has problems doing so (general error,
; REM ** user dosen't have rights to modify the registry, etc.) a message
; REM ** is sent to the system administrators alerting them to this fact.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $Domain = " "

; REM ** Checks to see which Control Set is Current
  IF ($OS = "WinNT4")
    $TempNumber = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\Select\", "Current")
    $TempString = "ControlSet00"+$TempNumber
  ENDIF

; REM ** Finds the DNS Domain Settings
  SELECT
    CASE $OS = "WinNT4"
      $Domain = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "Domain")
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $Domain = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "Domain")
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS Domain verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT     

; REM ** Checks the DNS Domain Setting and updates if necessary
  SELECT
    CASE $OS = "WinNT4"
      IF $Domain = "hidal.kodak.com"
        $Dummy = WRITELINE (10, "Verified DNS Domain Settings." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS Domain settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Domain Information: $Domain" + CHR(13) + CHR(10))
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "Domain", "hidal.kodak.com", "REG_SZ")
          $Reboot = "DNS Domain"
          $Dummy = WRITELINE (10, "Updated DNS Domain Settings." + CHR(13) + CHR(10))
          $TempString = "Updated "
        ELSE
          $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Domain Settings.  The current settings are $Domain.  Please correct the settings on this system."
          GOSUB SendAdminMail
          $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
          MESSAGEBOX ("Your DNS Domain settings are INCORRECT but could not be changed automatically.  A systems administrator has been notified of the problem.","Notice",4144)
          $Status = "Skipped "
        ENDIF
      ENDIF
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      IF $Domain = "hidal.kodak.com"
        $Dummy = WRITELINE (10, "Verified DNS Domain Settings." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Domain Information: $Domain" + CHR(13) + CHR(10))
        $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "Domain", "192.168.149.98,192.168.149.99", "REG_SZ")
        $Reboot = "DNS Domain"
        $Dummy = WRITELINE (10, "Updated DNS Domain Settings." + CHR(13) + CHR(10))
        $Status = "Updated    "
      ENDIF
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS Domain verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT
RETURN


:CheckDNSSearch
; REM ***********************************************************************
; REM **
; REM **  Checks to make sure that DNS suffix search order is correct.  If
; REM ** incorrect, the script edits the registery to insert the 
; REM ** correct value.  If the script has problems doing so (general error,
; REM ** user dosen't have rights to modify the registry, etc.) a message
; REM ** is sent to the system administrators alerting them to this fact.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $Domain = " "

; REM ** Checks to see which Control Set is Current
  IF ($OS = "WinNT4")
    $TempNumber = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\Select\", "Current")
    $TempString = "ControlSet00"+$TempNumber
  ENDIF

; REM ** Finds the DNS Search Order
  SELECT
    CASE $OS = "WinNT4"
      $Domain = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "SearchList")
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $Domain = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "SearchList")
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS Suffix Search Order verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT     

; REM ** Checks the DNS Suffix Search Order and updates if necessary
  SELECT
    CASE $OS = "WinNT4"
      IF $Domain = "hidal.kodak.com xrays.kodak.com kodak.com"
        $Dummy = WRITELINE (10, "Verified DNS Suffix Search Order." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS Domain settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Suffix Search Order Information: $Domain" + CHR(13) + CHR(10))
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "SearchList", "hidal.kodak.com xrays.kodak.com kodak.com", "REG_SZ")
          $Reboot = "DNS Search Order"
          $Dummy = WRITELINE (10, "Updated DNS Suffix Search Order." + CHR(13) + CHR(10))
          $Status = "Updated "
        ELSE
          $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Suffix Search Order Settings.  The current settings are $Domain.  Please correct the settings on this system."
          GOSUB SendAdminMail
          $Dummy = WRITELINE (10, "$EmailMesssage" + CHR(13) + CHR(10))
          MESSAGEBOX ("Your DNS Search Order settings are INCORRECT but could not be changed automatically.  A systems administrator has been notified of the problem.","Notice",4144)
          $Status = "Skipped "
        ENDIF
      ENDIF
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      IF $Domain = "hidal.kodak.com,xrays.kodak.com,kodak.com"
        $Dummy = WRITELINE (10, "Verified DNS Suffix Search Order." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      ELSE ; REM ** Sets the DNS settings correct if they are not
        $Dummy = WRITELINE (10, "Old DNS Suffix Search Order Information: $Domain" + CHR(13) + CHR(10))
        $Dummy = WRITEVALUE ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "SearchList", "hidal.kodak.com,xrays.kodak.com,kodak.com", "REG_SZ")
        $Reboot = "DNS Search Order"
        $Dummy = WRITELINE (10, "Updated DNS Suffix Search Order." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting DNS Suffix Search Order verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT
RETURN


:CheckWINS
; REM ***********************************************************************
; REM **
; REM **  Checks to make sure that the WINS settings are correct.  If they are
; REM ** found to be incorrect the script edits the registry to insert the 
; REM ** correct values.  If the script has problems doing so (general error,
; REM ** user dosen't have rights to modify the registry, etc.) a message
; REM ** is sent to the system administrators alerting them to this fact.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $NetCard = " "
  $WINS1 = " "
  $WINS2 = " "

; REM ** Checks to see which ControlSet and Network Card is Current
  IF ($OS = "WinNT4")
    $TempNumber = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\Select", "Current")
    $TempString = "ControlSet00"+$TempNumber
    $NetCard = ENUMKEY("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters",0)
  ENDIF

; REM ** Finds the WINS Server Settings
  SELECT
    CASE $OS = "WinNT4"
      $WINS1 = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServer")
      $WINS2 = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServerBackup")
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $WINS1 = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer1")
      $WINS2 = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer2")
    CASE 1 
      $Dummy = WRITELINE (10, "Unknown operating system, aborting WINS verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT

; REM ** Checks the WINS Settings
  IF (($WINS1 = "192.168.149.98") AND ($WINS2 = "192.168.149.99"))
    $Dummy = WRITELINE (10, "Verified WINS Settings." + CHR(13) + CHR(10))
    $Status = " " + CHR(251) + " OK   "
  ELSE
; REM ** Sets the WINS settings correct if they are not
    $Dummy = WRITELINE (10, "Old WINS Information: $WINS1 $WINS2" + CHR(13) + CHR(10))
    SELECT
      CASE $OS = "WinNT4"
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServer", "192.168.149.98", "REG_SZ")
          $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServerBackup", "192.168.149.99", "REG_SZ")
          $Reboot = "WINS"
          $Dummy = WRITELINE (10, "Updated WINS Settings" + CHR(13) + CHR(10))
          $Status = "Updated "
        ELSE  ;REM ** IF not correct then sends an alert.
          $EmailMessage = "@WKSTA (@FULLNAME) has incorrect WINS Settings.  The current settings are $WINS1 and $WINS2.  Please correct the settings on this system."
          GOSUB SendAdminMail
          $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
          MESSAGEBOX ("Your WINS settings are INCORRECT but could not be changed automatically.  A systems administrator has been notified of the problem.","Notice",4144)
          $Status = "Skipped "
        ENDIF
      CASE (($OS = "Win95") OR ($OS = "Win98"))
        $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer1", "192.168.149.98", "REG_SZ")
        $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer2", "192.168.149.99", "REG_SZ")
        $Reboot = "WINS"
        $Dummy = WRITELINE (10, "Updated WINS Settings" + CHR(13) + CHR(10))
        $Status = "Updated "
      CASE 1
        $Dummy = WRITELINE (10, "Unknown operating system, aborting WINS verification." + CHR(13) + CHR(10))
        $Status = "Aborted "
        RETURN
    ENDSELECT
  ENDIF
RETURN


:CheckSubnetMask
; REM ***********************************************************************
; REM **
; REM **  Checks to make sure that Subnet Mask is correct.  If incorrect, the
; REM ** script edits the registery to insert the correct value.  If the
; REM ** script has problems doing so (general error, user doesn't have
; REM ** rights to modify the registry, etc.) a message is sent to the system
; REM ** administrators alerting them to this fact.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $Mask = " "
  $NetCard = " "

; REM ** Checks to see which ControlSet and Network Card is Current
  IF (($OS = "WinNT4") OR ($OS = "Win2K"))
    $TempNumber = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\Select", "Current")
    $TempString = "ControlSet00"+$TempNumber
    $NetCard = ENUMKEY("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters",0)
  ELSE ; REM ** W95/98
    $TempString = READVALUE("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0000", "Driver")
  ENDIF

; REM ** Finds the Subnet Mask Settings
  SELECT
    CASE $OS = "WinNT4"
      $Mask = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\$NetCard\Parameters\Tcpip", "SubnetMask")
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $Mask = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\$TempString", "IPMask")
    CASE 1 
      $Dummy = WRITELINE (10, "Unknown operating system, aborting Subnet Mask verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT

; REM ** Checks the Subnet Mask Settings
  IF (SUBSTR($Mask,1,13) = "255.255.255.0") ; REM ** Ignore the ending '|'
    $Dummy = WRITELINE (10, "Verified Subnet Mask Settings." + CHR(13) + CHR(10))
    $Status = " " + CHR(251) + " OK   "
  ELSE
; REM ** Sets the WINS settings correct if they are not
    $Dummy = WRITELINE (10, "Old SubNet Mask Information: $Mask" + CHR(13) + CHR(10))
    SELECT
      CASE $OS = "WinNT4"
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\$NetCard\Parameters\Tcpip", "SubnetMask", "255.255.255.0", "REG_MULTI_SZ")
          $Reboot = "Subnet Mask"
          $Dummy = WRITELINE (10, "Updated Subnet Mask Settings" + CHR(13) + CHR(10))
          $Status = "Updated "
        ELSE  ;REM ** IF not correct then sends an alert.
          $EmailMessage = "@WKSTA (@FULLNAME) has incorrect Subnet Mask Settings.  The current setting is $Mask.  Please correct the settings on this system."
          GOSUB SendAdminMail
          $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
          MESSAGEBOX ("Your Subnet Mask settings are INCORRECT but could not be changed automatically.  A systems administrator has been notified of the problem.","Notice",4144)
          $Status = "Skipped "
        ENDIF
      CASE (($OS = "Win95") OR ($OS = "Win98"))
        $Dummy = WRITEVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\$TempString", "IPMask", "255.255.255.0", "REG_MULTI_SZ")
        $Reboot = "Subnet Mask"
        $Dummy = WRITELINE (10, "Updated Subnet Mask Settings" + CHR(13) + CHR(10))
        $Status = "Updated "
      CASE 1
        $Dummy = WRITELINE (10, "Unknown operating system, aborting Subnet Mask verification." + CHR(13) + CHR(10))
        $Status = "Aborted "
        RETURN
    ENDSELECT
  ENDIF
RETURN


:CheckScreenSaver
; REM ***********************************************************************
; REM **
; REM **  Checks to see if the user has a screen saver set, whether it is
; REM ** password protected, and if the timeout is greater than 15 min.
; REM **
; REM ***********************************************************************

  $Status = " " + CHR(251) + " OK   "
  SELECT
    CASE $OS = "WinNT4"
      IF VAL(READVALUE("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaveActive")) <> 1
        $Dummy = WRITEVALUE ("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
        $Dummy = WRITELINE (10, "Set Screen Saver Active." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
      IF VAL(READVALUE("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaveTimeOut")) > "1800"
        $Dummy = WRITEVALUE ("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaveTimeOut","1800","REG_SZ")
        $Dummy = WRITELINE (10, "Set Screen Saver Timeout to maximum of 30 min." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
      IF VAL(READVALUE("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaverIsSecure")) <> 1
        $Dummy = WRITEVALUE ("HKEY_USERS\@SID\Control Panel\Desktop","ScreenSaverIsSecure","1","REG_SZ")
        $Dummy = WRITELINE (10, "Turned on Password Protection." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
      $TempString = READVALUE("HKEY_USERS\@SID\Control Panel\Desktop","SCRNSAVE.EXE")
      SELECT
        CASE @ERROR = 0
        CASE @ERROR = 2
          $Dummy = WRITEVALUE("HKEY_USERS\@SID\Control Panel\Desktop","SCRNSAVE.EXE","%SYSTEMROOT%\System32\scrnsave.scr","REG_SZ")
          $Dummy = WRITELINE (10, "Turned on Default Screen Saver." + CHR(13) + CHR(10))
        $Status = "Updated "
        CASE 1
          GOSUB DisplayError
      ENDSELECT
      IF $TempString = "(None)"
        $Dummy = WRITEVALUE("HKEY_USERS\@SID\Control Panel\Desktop","SCRNSAVE.EXE","%SYSTEMROOT%\System32\scrnsave.scr","REG_SZ")
        $Dummy = WRITELINE (10, "Turned on Default Screen Saver." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $TempString = READPROFILESTRING ("%windir%\SYSTEM.ini","boot","SCRNSAVE.EXE")
      IF SUBSTR($TempString,LEN($TempString)-2,3) = "scr"
      ELSE
        $Dummy = WRITEPROFILESTRING ("%windir%\SYSTEM.ini","boot","SCRNSAVE.EXE","%windir%\SYSTEM\FLYING~1.SCR")
        $Reboot = "Screen Saver"
        $Dummy = WRITELINE (10, "Turned on Default Screen Saver" + CHR(13) + CHR(10))
        $Status = "Updated "
        ENDIF
      IF READVALUE("HKEY_USERS\.Default\Control Panel\Desktop","ScreenSaveActive") <> 1
        $Dummy = WRITEVALUE ("HKEY_USERS\.Default\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
        $Dummy = WRITELINE (10, "Set Screen Saver Active." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
      IF VAL(READVALUE("HKEY_USERS\.Default\Control Panel\Desktop","ScreenSaveTimeOut")) > "1800"
        $Dummy = WRITEVALUE ("HKEY_USERS\.Default\Control Panel\desktop","ScreenSaveTimeOut","1800","REG_SZ")
        $Dummy = WRITELINE (10, "Set Screen Saver Timeout to maximum of 30 min." + CHR(13) + CHR(10))
        $Status = "Updated "
      ENDIF
    CASE 1
      $Dummy = WRITELINE (10, "Unknown operating system, aborting screensaver verification." + CHR(13) + CHR(10))
      $Status = "Aborted "
      RETURN
  ENDSELECT
RETURN


:CheckAutoLogon
; REM ***********************************************************************
; REM **
; REM **  Checks to see if the user has enabled auto-logon on their WinNT
; REM ** system, and if so disables it.  Corporate security requires that
; REM ** all systems be manually logged into.  Q97597
; REM **
; REM ***********************************************************************

  SELECT
    CASE ($OS = "WinNT4")
      IF (EXISTKEY("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword") = 0)
        IF (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin"))
          DELVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword")
          DELVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon")
          $Dummy = WRITELINE (10, "Disabled auto-logon." + CHR(13) + CHR(10))
          MESSAGEBOX ("Corporate security requires that all systems be manually logged into.  The auto-logon function has been disabled.  See ICS document 10.3.1 for more information.","Notice",4112)
          $Status = "Updated "
        ELSE
         $EmailMessage = "@USERID (@FULLNAME) on computer @WKSTA needs to have to have auto-logon disabled."
         $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
         GOSUB SendAdminMail
         $Status = "Skipped "
        ENDIF
      ELSE
        $Status = " " + CHR(251) + " OK   "
      ENDIF
    CASE (($OS = "Win95") OR ($OS = "Win98"))
      $Status = "Skipped "
    CASE 1 
      $Dummy = WRITELINE (10, "Unknown operating system, aborting auto-logon check." + CHR(13) + CHR(10))
      $Status = "Aborted "
  ENDSELECT
RETURN


:CheckMcAfee
; REM ***********************************************************************
; REM **
; REM **  Checks to see if McAfee anti-virus is installed and if the virus
; REM ** signatures are the most current.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $AVCurrentVersion="4.0"                           ; REM ** Current version of anti-virus software
  $AVName = "McAfee"                                ; REM ** Name of the anti-virus software package
  $AVPath = " "                                     ; REM ** Where the user has the anti-virus signatures installed
  $AVUpdatePath = "\\DATA03\Installs\Virus\McAfee"  ; REM ** Location of anti-virus signature updates
  $AVVersion = " "                                  ; REM ** Currently installed version of anti-virus software

  IF (ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\VirusScan") = 0)
    $AVPath=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\VirusScan", "DAT")
    $AVVersion = SUBSTR(READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\VirusScan", "szProductVer"), 1, 3)
  ELSE
    $EmailMessage = "@USERID (@FULLNAME) on computer @WKSTA needs to have $AVName anti-virus installed."
    $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
    GOSUB SendAdminMail
    $Status = "Skipped "
    RETURN
  ENDIF

  IF ($AVVersion = $AVCurrentVersion) ; REM ** Don't update the local signatures if the client software hasn't been updated yet.
    $TempString = COMPAREFILETIMES("$AVUpdatePath\Version 4.x Signatures\File_Id.diz", "$AVPath\File_Id.diz")
    SELECT
      CASE $TempString = -2
        $EmailMessage = "@USERID on computer @WKSTA could not locate $AVName anti-virus signatures on server."
        $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
        GOSUB SendAdminMail
        $Status = " Error  "
      CASE $TempString = -1
        $EmailMessage = "@USERID on computer @WKSTA has a newer version of $AVName anti-virus signatures than is installed on the server."
        $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
        GOSUB SendAdminMail
        $Status = "Skipped "
      CASE $TempString = 0
        $Dummy = WRITELINE (10, "Verified $AVName anti-virus signature version." + CHR(13) + CHR(10))
        $Status = " " + CHR(251) + " OK   "
      CASE 1 ; REM ** This will also copy the updates if the update file is not found on the local client system.
        COPY "$AVUpdatePath\Version 4.x Signatures\clean.dat"    "$AVPath\clean.dat"
        COPY "$AVUpdatePath\Version 4.x Signatures\file_id.diz"  "$AVPath\file_id.diz"
        COPY "$AVUpdatePath\Version 4.x Signatures\internet.dat" "$AVPath\internet.dat"
        COPY "$AVUpdatePath\Version 4.x Signatures\mcscript.ini" "$AVPath\mcscript.ini"
        COPY "$AVUpdatePath\Version 4.x Signatures\names.dat"    "$AVPath\names.dat"
        COPY "$AVUpdatePath\Version 4.x Signatures\packing.lst"  "$AVPath\packing.lst"
        COPY "$AVUpdatePath\Version 4.x Signatures\pkgdesc.ini"  "$AVPath\pkgdesc.ini"
        COPY "$AVUpdatePath\Version 4.x Signatures\reseller.txt" "$AVPath\reseller.txt"
        COPY "$AVUpdatePath\Version 4.x Signatures\scan.dat"     "$AVPath\scan.dat"
        COPY "$AVUpdatePath\Version 4.x Signatures\validate.exe" "$AVPath\validate.exe"
        COPY "$AVUpdatePath\Version 4.x Signatures\whatsnew.txt" "$AVPath\whatsnew.txt"
        $Dummy = WRITELINE (10, "$AVName anti-virus signatures updated." + CHR(13) + CHR(10))
        $Status = "Updated "
    ENDSELECT
  ELSE
    $EmailMessage = "@USERID (@FULLNAME) on computer @WKSTA needs to have $AVName anti-virus software updated from v$AVVersion to v$AVCurrentVersion."
    $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
    GOSUB SendAdminMail
    $Status = "Skipped "
  ENDIF
RETURN


:CheckNorton
; REM ***********************************************************************
; REM **
; REM **  Checks to see if Norton anti-virus is installed and if the virus
; REM ** signatures are the most current.  Currently only known to work with
; REM ** v2.0 on NT systems, not tested with other versions or OS's.
; REM **
; REM ***********************************************************************
; REM ** Local variables in use by this function are:
  $AVName = "Norton"                                ; REM ** Name of the anti-virus software package
  $AVPath = " "                                     ; REM ** Where the user has the anti-virus signatures installed
  $AVUpdatePath = "\\DATA03\Installs\Virus\Norton AntiVirus"  ; REM ** Location of anti-virus signature updates

  IF (ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Norton AntiVirus NT") = 0)
    SELECT
      CASE (READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Norton AntiVirus NT\Install\4.0", "Installed") = 1)
        $AVPath=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Norton AntiVirus\Virus Defs\Location", "")
        $TempString = COMPAREFILETIMES("$AVUpdatePath\Extracted\virscan.inf", "$AVPath\virscan.inf")
        SELECT
          CASE $TempString = -2
            $EmailMessage = "@USERID on computer @WKSTA could not locate $AVName anti-virus signatures on server."
            $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
            GOSUB SendAdminMail
            $Status = " Error  "
          CASE $TempString = -1
            $EmailMessage = "@USERID on computer @WKSTA has a newer version of $AVName anti-virus signatures than is installed on the server."
            $Dummy = WRITELINE (10, "$EmailMessage" + CHR(13) + CHR(10))
            GOSUB SendAdminMail
            $Status = "Skipped "
          CASE $TempString = 0
            $Dummy = WRITELINE (10, "Verified $AVName anti-virus signature version." + CHR(13) + CHR(10))
            $Status = " " + CHR(251) + " OK   "
          CASE 1 ; REM ** This will also copy the updates if the update file is not found on the local client system.
            COPY "$AVUpdatePath\Extracted\navex.sys"    "$AVPath\navex.sys"
            COPY "$AVUpdatePath\Extracted\navex32.dll"  "$AVPath\navex32.dll"
            COPY "$AVUpdatePath\Extracted\ncsacert.txt" "$AVPath\ncsacert.txt"
            COPY "$AVUpdatePath\Extracted\technote.txt" "$AVPath\technote.txt"
            COPY "$AVUpdatePath\Extracted\update.txt"   "$AVPath\update.txt"
            COPY "$AVUpdatePath\Extracted\virscan.dat"  "$AVPath\virscan.dat"
            COPY "$AVUpdatePath\Extracted\virscan.inf"  "$AVPath\virscan.inf"
            COPY "$AVUpdatePath\Extracted\virscan2.dat" "$AVPath\virscan2.dat"
            COPY "$AVUpdatePath\Extracted\whatsnew.txt" "$AVPath\whatsnew.txt"
            $Dummy = WRITELINE (10, "$AVName anti-virus signatures updated." + CHR(13) + CHR(10))
            $Dummy = Messagebox("Your virus signatures have been updated.  In order for the update to take affect, you will need to start Norton AntiVirus and run a scan for viruses on your system.  Scanning your drive activates the new virus definitions and rebuilds critical files.","NOTICE",64,30)
            $Status = "Updated "
        ENDSELECT
      CASE 1
        $Dummy = WRITELINE (10, "Unknown version of $AVName anti-virus software." + CHR(13) + CHR(10))
        $Status = "Skipped "
        RETURN
    ENDSELECT
  ELSE
    $Dummy = WRITELINE (10, "$AVName anti-virus is not installed on this computer." + CHR(13) + CHR(10))
    $Status = "Skipped "
    RETURN
  ENDIF
RETURN


:MapHomeDirectory
; REM ***********************************************************************
; REM **
; REM **  Map the user's home directory (H:) to their share on DATA01.
; REM **
; REM ***********************************************************************

  USE H: /DELETE /PERSISTENT
  USE H: "\\DATA01\@USERID" /PERSISTENT
  IF @ERROR
    $EmailMessage = "Could not mount @FULLNAME's home directory."
    $Dummy = WRITELINE (10, $EmailMessage + CHR(13) + CHR(10))
    GOSUB SendAdminMail
    $Status = " Error  "
    MESSAGEBOX ("A problem was encountered trying to mount your home directory.  A systems administrator has been notified of the problem.","Notice",48)
  ELSE
    $Dummy = WRITELINE (10, "Mapped user's home directory." + CHR(13) + CHR(10))
    IF (($OS = "WinNT4") OR ($OS = "Win2K"))
      SET "HOMEDRIVE=H:"
    ENDIF
    $Status = " " + CHR(251) + " OK   "
  ENDIF
RETURN


:MapProjectDirectory
; REM ***********************************************************************
; REM **
; REM **  Map the user's various project directories.
; REM **
; REM ***********************************************************************

  $ErrorNumber = 0
  IF INGROUP ("IS&C Team")
    USE I: /DELETE /PERSISTENT
    USE I: "\\DATA01\IS&C" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive I:  \\DATA01\IS&C" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive I:  \\DATA01\IS&C"
      $Dummy = WRITELINE (10, "Mapped project drive I:  \\DATA01\IS&C" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Image Server")
    USE L: /DELETE /PERSISTENT
    USE L: "\\DATA04\Image Server" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive L: \\DATA04\Image Server" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive L:  \\DATA04\Image Server"
      $Dummy = WRITELINE (10, "Mapped project drive L:  \\DATA04\Image Server" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Soft Conf Management")                ; REM ** Duplicate Drive Mapping!
    USE M: /DELETE /PERSISTENT
    USE M: "\\DATA04\SCM" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive M: \\DATA04\SCM" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive M:  \\DATA04\SCM"
      $Dummy = WRITELINE (10, "Mapped project drive M:  \\DATA04\SCM" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Manufacturing")                       ; REM ** Duplicate Drive Mapping!
    USE M: /DELETE /PERSISTENT
    USE M: "\\DATA04\Manufact" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive M: \\DATA04\Manufact" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive M:  \\DATA04\Manufact"
      $Dummy = WRITELINE (10, "Mapped project drive M:  \\DATA04\Manufact" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Quality Eng Doc")
    USE N: /DELETE /PERSISTENT
    USE N: "\\DATA04\Qual Eng Doc" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive N: \\DATA04\Qual Eng Doc" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive N:  \\DATA04\Qual Eng Doc"
      $Dummy = WRITELINE (10, "Mapped project drive N:  \\DATA04\Qual Eng Doc" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("SourceSafe")
    USE O: /DELETE /PERSISTENT
    USE O: "\\DATA04\SourceSafe" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive O:  \\DATA04\SourceSafe" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive O:  \\DATA04\SourceSafe"
      $Dummy = WRITELINE (10, "Mapped project drive O:  \\DATA04\SourceSafe" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Pro-Act")
    USE P: /DELETE /PERSISTENT
    USE P: "\\DATA04\PRO-ACT" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive P:  \\DATA04\PRO-ACT" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive P:  \\DATA04\PRO-ACT"
      $Dummy = WRITELINE (10, "Mapped project drive P:  \\DATA04\PRO-ACT" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Quality Eng")
    USE Q: /DELETE /PERSISTENT
    USE Q: "\\DATA04\Quality Eng" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive Q:  \\DATA04\Quality Eng" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive Q:  \\DATA04\Quality Eng"
      $Dummy = WRITELINE (10, "Mapped project drive Q:  \\DATA04\Quality Eng" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Regulatory Affairs")         ; REM ** Duplicate Drive Mapping!
    USE R: /DELETE /PERSISTENT
    USE R: "\\DATA04\RegAff" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive R:  \\DATA04\RegAff" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive R:  \\DATA04\RegAff"
      $Dummy = WRITELINE (10, "Mapped project drive R:  \\DATA04\RegAff" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Sales Support")              ; REM ** Duplicate Drive Mapping!
    USE R: /DELETE /PERSISTENT
    USE R: "\\DATA04\SalesSupport" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive R:  \\DATA04\SalesSupport" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive R:  \\DATA04\SalesSupport"
      $Dummy = WRITELINE (10, "Mapped project drive R:  \\DATA04\SalesSupport" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Continuus")                  ; REM ** Duplicate Drive Mapping!
    USE S: /DELETE /PERSISTENT
    USE S: "\\DATA04\CCM_BA" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive S:  \\DATA04\CCM_BA" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive S:  \\DATA04\CCM_BA"
      $Dummy = WRITELINE (10, "Mapped project drive S:  \\DATA04\CCM_BA" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("System Test")                ; REM ** Duplicate Drive Mapping!
    USE S: /DELETE /PERSISTENT
    USE S: "\\DATA04\System Test" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive S:  \\DATA04\System Test" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive S:  \\DATA04\System Test"
      $Dummy = WRITELINE (10, "Mapped project drive S:  \\DATA04\System Test" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Technical Comm.")            ; REM ** Duplicate Drive Mapping!
    USE T: /DELETE /PERSISTENT
    USE T: "\\DATA04\T&TC" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive T:  \\DATA04\T&TC" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive T:  \\DATA04\T&TC"
      $Dummy = WRITELINE (10, "Mapped project drive T:  \\DATA04\T&TC" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("TSC")                        ; REM ** Duplicate Drive Mapping!
    USE T: /DELETE /PERSISTENT
    USE T: "\\DATA04\TSC" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive T:  \\DATA04\TSC" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive T:  \\DATA04\TSC"
      $Dummy = WRITELINE (10, "Mapped project drive T:  \\DATA04\T&TC" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("PVCS Users")
    USE U: /DELETE /PERSISTENT
    USE U: "\\DATA01\PVCS Data" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive U:  \\DATA01\PVCS Data" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive U:  \\DATA01\PVCS Data"
      $Dummy = WRITELINE (10, "Mapped project drive U:  \\DATA01\PVCS Data" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("MVS")
    USE W: /DELETE /PERSISTENT
    USE W: "\\DATA04\MVS" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive W:  \\DATA04\MVS" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive W:  \\DATA04\MVS"
      $Dummy = WRITELINE (10, "Mapped project drive W:  \\DATA04\MVS" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("Dicom V & V")
    USE V: /DELETE /PERSISTENT
    USE V: "\\DATA04\Dicom V & V" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive V:  \\DATA04\Dicom V & V" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive V:  \\DATA04\Dicom V & V"
      $Dummy = WRITELINE (10, "Mapped project drive V:  \\DATA04\Dicom V & V" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF INGROUP ("PVCS Users")
    USE X: /DELETE /PERSISTENT
    USE X: "\\DATA01\PVCS Application" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map project drive X:  \\DATA01\PVCS Application" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive X:  \\DATA01\PVCS Application"
      $Dummy = WRITELINE (10, "Mapped project drive X:  \\DATA01\PVCS Application" + CHR(13) + CHR(10))
    ENDIF
  ENDIF
  IF ($ErrorNumber > 0)
    $EmailMessage = "Problems mounting user's project directory(s)."
    $Dummy = WRITELINE (10, $EmailMessage + CHR(13) + CHR(10))
    GOSUB SendAdminMail
    $Status = " Error  "
    MESSAGEBOX ("A problem was encountered trying to mount one of your project directories.  A systems administrator has been notified of the problem.","Notice",48)
  ELSE
    $Status = " " + CHR(251) + " OK   "
  ENDIF
RETURN


:Main
; REM ***********************************************************************
; REM **
; REM **  Main section of the script.
; REM **
; REM ***********************************************************************

  BREAK OFF
  $Dummy = SETCONSOLE ("ALWAYSONTOP")
  GOSUB VerifyInitialSetup
  GOSUB DrawHeaderBox
  IF $DisplayWarning="Yes"
    GOSUB DrawSecurityBox
    $Dummy = WRITELINE (10, "Complete system debug info below:" + CHR(13) + CHR(10))
    GOSUB GetDebugInfo
    $Dummy = WRITELINE (10, $TempString)
    GOSUB DrawHeaderBox
  ENDIF

  IF (UCASE(READPROFILESTRING ($INIFile,"Override","SyncTime")) = "NO")
    $Dummy = WRITELINE (10, "Time syncronization overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,4) CHR(254) + " Syncronizing Local Clock with Logon Server ..."
    GOSUB SyncTime
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  AT ($Row,4) CHR(254) + " Verifying Network Configuration ..."
  $Row = $Row + 1
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckDNS")) = "NO")
    $Dummy = WRITELINE (10, "DNS verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "DNS Servers                                                     Checking"
    GOSUB CheckDNS
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckDNSDomain")) = "NO")
    $Dummy = WRITELINE (10, "DNS Domain verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "DNS Domain                                                      Checking"
    GOSUB CheckDNSDomain
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckDNSSearch")) = "NO")
    $Dummy = WRITELINE (10, "DNS suffix search order verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "DNS Search Order                                                Checking"
    GOSUB CheckDNSSearch
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckWINS")) = "NO")
    $Dummy = WRITELINE (10, "WINS verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "WINS Servers                                                    Checking"
    GOSUB CheckWINS
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckSubnetMask")) = "NO")
    $Dummy = WRITELINE (10, "Subnet Mask verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "Subnet Mask                                                     Checking"
    GOSUB CheckSubnetMask
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF $Reboot <> "No" ; REM ** Have any system settings changed?
    GOSUB End
  ENDIF
  AT ($Row,4) CHR(254) + " Verifying Software Configuration ..."
  $Row = $Row + 1
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckMcAfee")) = "NO")
    $Dummy = WRITELINE (10, "McAfee anti-virus verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "McAfee Anti-Virus Signatures ...                                Checking"
    GOSUB CheckMcAfee
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckNorton")) = "NO")
    $Dummy = WRITELINE (10, "Norton anti-virus verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "Norton Anti-Virus Signatures ...                                Checking"
    GOSUB CheckNorton
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  AT ($Row,4) CHR(254) + " Verifying User Profile Configuration ..."
  $Row = $Row + 1
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","CheckScreenSaver")) = "NO")
    $Dummy = WRITELINE (10, "Screen saver verification overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,6) "Screen Saver Settings ...                                       Checking"
    GOSUB CheckScreenSaver
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  AT ($Row,6) "Auto-logon check ...                                            Checking"
  GOSUB CheckAutoLogon
  AT ($Row,70) "$Status"
  $Row = $Row + 1
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","MapHomeDirectory")) = "NO")
    $Dummy = WRITELINE (10, "Home directory mounting overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,4) CHR(254) + " Mapping Home Directory to Drive H: ..."
    GOSUB MapHomeDirectory
    AT ($Row,70) "$Status"
    $Row = $Row + 1
  ENDIF
  IF (UCASE(READPROFILESTRING ($INIFile,"Override","MapProjectDirectory")) = "NO")
    $Dummy = WRITELINE (10, "Project directory mounting overridden by .INI setting." + CHR(13) + CHR(10))
  ELSE
    AT ($Row,4) CHR(254) + " Mapping Project Directories ..."
    GOSUB MapProjectDirectory
    AT ($Row,70) "$Status"
  ENDIF
  AT (25,79) ; REM ** Move the cursor out of the way.
  SLEEP 1 ; REM ** Give the user an opportunity to at least see the screen.
GOTO End


:End
; REM ***********************************************************************
; REM **
; REM **  Clean up, and close the debug file.
; REM **
; REM ***********************************************************************

  IF ($Reboot <> "No")
    $TempNumber = Messagebox("Your $Reboot settings have been updated.  Your computer needs to be rebooted before the new settings can take effect.  Do you wish to reboot your computer now?","NOTICE",36)
    IF ($TempNumber = 6) ; REM ** Yes
      $Dummy = WRITELINE (10, "$Reboot settings have been updated.  The computer must be rebooted in order for these changes to take effect." + CHR(13) + CHR(10))
      SELECT
        CASE $OS = "WinNT4"
          $Dummy = WRITELINE (10, "@USERID's $Reboot settings were changed by the logon script on @WKSTA.  @USERID rebooted." + CHR(13) + CHR(10))
          $Dummy = WRITELINE (10, "*** End of Debug trace." + CHR(13) + CHR(10))
          $Dummy = CLOSE (10)
          SHUTDOWN ("","Please wait while your computer is being rebooted.",0,1,1)
          EXIT
        CASE (($OS = "Win95") OR ($OS = "Win98"))
          $Dummy = WRITELINE (10, "@USERID's $Reboot settings were changed by the logon script on @WKSTA.  Computer could not be rebooted automatically." + CHR(13) + CHR(10))
          $Dummy = Messagebox("Win95 / Win98 systems cannot be automatically rebooted.  Please shutdown and restart your computer now.","NOTICE",0)
        CASE 1
          $Dummy = WRITELINE (10, "@USERID's $Reboot settings were changed by the logon script on @WKSTA.  Computer could not be rebooted automatically." + CHR(13) + CHR(10))
          $Dummy = Messagebox("Your computer cannot be automatically rebooted.  Please shutdown and restart your computer now.","NOTICE",0)
      ENDSELECT
    ELSE
      $Dummy = WRITELINE (10, "@USERID's $Reboot settings were changed by the logon script on @WKSTA.  @USERID chose not to reboot." + CHR(13) + CHR(10))
      $Reboot = "No"
      RETURN ; REM ** Go back to main()
    ENDIF
  ENDIF
  $Dummy = WRITELINE (10, "*** End of Debug trace @TIME @DATE." + CHR(13) + CHR(10))
  $Dummy = CLOSE (10)
EXIT