; McAfee.kix - a script to automate McAfee installs and upgrades ; on Windows 95, 98, ME, NT, 2000 and XP machines. ; Exclude the CS Labs subnets, because they use their own build $address = @IPADDRESS0 $subnet = SUBSTR($address,9,3) ; NOTE - octets are returned in sets of three characters ; regardless of the actual number of the subnet, so the ; spaces inside the double quotes are ESSENTIAL. If you ; remove them, you break the detection - subnet 3, for example, ; would be " 3", not "3". IF ($subnet = " 92" OR $subnet = " 97") GOTO END ENDIF ; Check for group membership to see if we run McAfee IF (InGroup ("NoMcAfee")) GOTO "END" ENDIF ; exclude all Servers and Domain Controllers from login updates and ; installs just in case some idiot logs in locally at the console $OSVal = @PRODUCTTYPE IF ( (INSTR ($OSVal,"Server") <> 0) OR (INSTR ($OSVal,"Domain Controller") <> 0) ) GOTO "END" ENDIF ; Check to see if the user has local admin rights so we can install and update ; If they don't, popup a warning and set a cookie, then send them on to install ; If the cookie already exists, check to see if it's a month old, and popup the ; warning again if it is - otherwise just go on to install IF INGROUP ("\\@WKSTA\ADMINISTRATORS") $Admin = "1" ENDIF $priv_cookie = @HOMEDRIVE + "priv_cookie.txt" $month = SUBSTR(@DATE,6,2) IF Open(1,$priv_cookie,2) = 0 $x = ReadLine(1) $last = SUBSTR($x,6,2) IF $last <> $month OPEN(1,$priv_cookie,5) WRITELINE (1,@DATE) CLOSE(1) $TypeOS = @INWIN IF $TypeOS = 1 IF $Admin <> "1" GOTO "WARNING" ENDIF ENDIF ELSE GOTO "INSTALL" ENDIF Close (1) ELSE OPEN(1,$priv_cookie,5) WRITELINE(1,@DATE) CLOSE (1) $TypeOS = @INWIN IF $TypeOS = 1 IF $Admin <> "1" GOTO "WARNING" ENDIF ENDIF ENDIF :INSTALL ; Create some string values for use later $regPath="HKEY_LOCAL_MACHINE\SOFTWARE\" $appsPath="\\utdfp3\allshare\Installs\NAI\" ; Get the present SuperDAT filename $sDATString=DIR ($appsPATH + "SuperDAT\sdat*.exe") ; Parse the SuperDAT string for the version number $sDATVer=SUBSTR($sDATString,5,4) ; Determine which version (if any) of McAfee is installed $VS45Code=KeyExist($regPath + "Network Associates\TVD\VirusScan\AVConsol") $VS70Code=KeyExist($regPath + "Network Associates\TVD\VirusScan Enterprise") ; Go to the right subroutine based on McAfee version or "None" SELECT CASE $VS45Code=1 GOTO "VS45" CASE $VS70Code=1 GOTO "VS70" CASE 1 GOTO "DETECTOS" ENDSELECT :DETECTOS $OS = @DOS $OSNum = substr($OS,1,1) IF $OSNum = 5 GOTO "VIRUSSCAN_7.0.0" ELSE GOTO "VIRUSSCAN_4.5.1" ENDIF :VS45 $VS45DATValue = READVALUE($RegPath + "Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szDatVersion") $VS45DATNum = SUBSTR($VS45DATValue,5,4) $VS45CurrentVersion = READVALUE($RegPath + "Network Associates\TVD\VirusScan","szCurrentVersionNumber") $VS45VersionNum = SUBSTR($VS45CurrentVersion,7,4) $VS450VersionNum = SUBSTR($VS45CurrentVersion,5,1) $installDir=READVALUE($regPath + "Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szInstallDir") ; If they're running Win2k or XP and they have VS 4.5.1, uninstall so we can install 7.0.0 $OS = @DOS $OSNum = substr($OS,1,1) IF $OSNum = 5 $return = MESSAGEBOX("The system has determined that a newer version of McAfee " + "is available for your computer. Before it can be installed " + "the present version must be removed. When the uninstall is " + "completed, a reboot will be required. To begin the removal " + "please click on OK.", "VirusScan 4.5.1 Uninstall", 64) RUN $appsPath + "VirusScan 4.5.1\setup.exe" + " REMOVE=ALL REBOOT=F/qb+/i" GOTO "END" ENDIF ; If they're running WIn9x, NT or ME, upgrade from 4.5.0 to 4.5.1, SP1 or update the DATs IF VAL ($VS450VersionNum) = 0 GOTO "VIRUSSCAN_4.5.1" ELSE IF VAL($VS45VersionNum) <> VAL("1306") $return = MESSAGEBOX("The system has determined that your anti-virus software needs an update. " + "When you click on OK, the system will begin the Service Pack 1 " + "installation", "Service Pack 1 Install", 64) RUN ($appsPath + "VirusScan 4.5.1\SP1\VSC451S1.EXE" + " /silent /prompt") GOTO "END" ELSE IF VAL($sDATVer) > VAL($VS45DATNum) ; if the SuperDAT is not up-to-date GOTO "SuperDAT" ELSE GOTO "END" ENDIF ENDIF ENDIF ; warn the user if they aren't admin on the box and then go to install :WARNING $return = MESSAGEBOX("The system has determined that you do not have sufficient rights " + "to install or uninstall software on this computer. This means that " + "you cannot update your antivirus software or apply any security " + "patches.@CRLF@CRLFThis may or may not be what your department policy " + "is. If you're not sure what the policy is, please check with your " + "department to be sure. If you do have sufficient rights to install " + "software but you're getting this message anyway, please contact your " + "departmental techs or call the UTD Campus Help Desk at x2911 and ask " + "for assistance.@CRLF@CRLFThis message will appear each month, as a " + "reminder. ","Monthly Reminder", 64) GOTO "INSTALL" :VS70 $VS70DATVal = READVALUE($regPath + "Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx","szVirDefVer") $VS70DATNum = SUBSTR($VS70DATVal,5,4) $MidCfgDir=READVALUE($regPath + "Network Associates\TVD\VirusScan Enterprise\CurrentVersion","szMidConfigDir") $MidPath = ($appsPath + "VirusScan 7.0.0\VSECFG_W.CAB") $MidFile = "VSECFG_W.CAB" ; make sure the midfile is installed and up to date ; and update the DATs for VS 7.0.0 installs IF EXIST ($MidCfgDir + $Midfile) $Result = CompareFileTimes($MidPath,$MidCfgDir + $Midfile) IF $Result = 1 COPY $MidPath $MidCfgDir + $Midfile ENDIF ELSE COPY $MidPath $MidCfgDir + $Midfile ENDIF IF VAL($sDATVer) > VAL($VS70DATNum) GOTO "SuperDAT" ELSE GOTO "END" ENDIF ; Install the SuperDAT :SuperDAT IF @INWIN=2 SLEEP 2 ENDIF $return = MESSAGEBOX("The system has determined that your anti-virus DAT files are out of date. " + "When you click on OK, the system will start the McAfee SuperDAT update. " + "You will be prompted if you need to reboot.", "SuperDAT update", 64) RUN ($appsPath + "SuperDAT\" + $sDATString + " /silent /prompt") GOTO "END" ; Install McAfee VirusScan 4.5.1 :VIRUSSCAN_4.5.1 $return = MESSAGEBOX("The system has determined that your computer did not have the latest version " + "of McAfee VirusScan installed. When you click on OK, the system will start " + "the McAfee VirusScan 4.5.1 installation. You may be prompted to reboot when " + "the installation is complete.","VirusScan Install",64) RUN $appsPath + "VirusScan 4.5.1\setup.exe" + " /qb+" GOTO "END" ; Install McAfee VirusScan 7.0.0 :VIRUSSCAN_7.0.0 $return = MESSAGEBOX("The system has determined that your computer did not have the latest version " + "of McAfee VirusScan installed. When you click on OK, the system will start " + "the McAfee VirusScan 7.0.0 installation. You will be prompted to reboot when " + "the installation is complete.","VirusScan Install",64) RUN $appsPath + "VirusScan 7.0.0\setup.exe" + " ENABLEONACCESSSCANNER=True REBOOT=True /qb+" ;$RC = Shutdown("", "System is being rebooted to enable new settings.", 60, 0, 1) GOTO "END" :END