; Dialup.scr ; This script checks to see if a user is a remote user, either dialup or VPN. ; If they are, it offers them the choice of running the McAfee updates or not ; running them, and then it asks them if they want us to "remember" their choice. ; If they choose Yes, it creates a registry key in the VirusScan hive with the appropriate ; value in it. The next time the script runs, it looks at that value and takes ; the appropriate action based upon their previous choice ; Check for group membership to see if we run McAfee IF (InGroup ("NoMcAfee")) GOTO "END" ENDIF ; Get the user's IP address $address=@IPADDRESS0 ; Parse the subnet from the IP $subnet=SUBSTR($address,9,3) ; Parse the node address, but make it an integer value first ; (KiX variables assume the type that they are first assigned ; and we need an integer value here to limit the node range.) $node=1 $node=SUBSTR($address,13,3) ; If they're dialup users or vpn users, run the following script portion ; otherwise, run the McAfee script (mcafee.scr) IF ($subnet=" 82" OR $subnet=" 40" OR ($subnet=" 27" AND ($node > 237 AND $node < 246))) ; In this section we determine if a registry key exists. If it doesn't, we create it. If ; it does, we check for its value. The value determines whether we proceed or exit. The ; key varies depending on the version of VirusScan, so we have to branch to three sections. ; If they don't have McAfee installed, we branch to the Choose subroutine. $regPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\" $VS403Code=ExistKey($regPath + "McAfee VirusScan") $NetShield403Code=ExistKey($regPath + "NetShield NT") $VS45Code=ExistKey($regPath + "TVD\VirusScan") SELECT CASE $VS403Code = 0 GOTO "VirusScan403" CASE $NetShield403Code = 0 GOTO "NetShieldNT403" CASE $VS45Code = 0 GOTO "VirusScan45" CASE 1 GOSUB "Choose" ENDSELECT :VirusScan403 $VS403Choice=EXISTKEY($regPath + "McAfee VirusScan\Dialup") IF $VS403Choice = 0 $choice = READVALUE($regPath + "McAfee VirusScan\Dialup", "") IF $choice = 7 GOTO "END" ELSE GOTO "RunMcAfee" ENDIF ELSE $regValue = ($regPath + "McAfee VirusScan\Dialup") GOSUB "Choose" ENDIF :NetShieldNT403 $NS403Choice=EXISTKEY($regPath + "NetShieldNT\Dialup") IF $NS403Choice = 0 $choice = READVALUE($regPath + "NetShieldNT\Dialup", "") IF $choice = 7 GOTO "END" ELSE GOTO "RunMcAfee" ENDIF ELSE $regValue = ($regPath + "NetShieldNT\Dialup") GOSUB "Choose" ENDIF :VirusScan45 $VS45Choice=EXISTKEY($regPath + "TVD\VirusScan\Dialup") IF $VS45Choice = 0 $choice = READVALUE($regPath + "TVD\VirusScan\Dialup", "") IF $choice = 7 GOTO "END" ELSE GOTO "RunMcAfee" ENDIF ELSE $regValue = ($regPath + "TVD\VirusScan\Dialup") GOSUB "Choose" ENDIF ; This "else" routes all non-dialup or VPN users to the McAfee.scr script ELSE CALL "McAfee.scr" GOTO "END" ENDIF ; Everything below here is subroutines ; This section calls the McAfee.scr script :RunMcAfee CALL "McAfee.scr" GOTO "END" ; Give the user a choice of running the updates or not running them and ; set a registry value if they want their choice remembered. :Choose $return = MESSAGEBOX("When you log in to our NT domains, we offer automatic virus updates." + " On a dialup connection, these virus installs and updates can " + "take quite some time, depending on the speed of your connection." + "Therefore, we give you the option of opting out of the updates." + " If you would like the update to run, click on Yes. If you " + "don't want it to run, click on No.","Install and Update McAfee?",68) $repeat = MESSAGEBOX("If you'd like us to remember your choice we can set a registry key " + "on your system. If you click on Yes, we will never prompt " + "you again, but you would not be able to change your choice " + "later unless you remove the registry key. (The registry key is " + $regValue + ") If you click No, you will see these prompts " + "each time you log in (until you click Yes.)","Never Prompt Again?", 68) IF $return=6 IF $repeat=6 GOSUB "WriteKey" GOTO "RunMcafee" ELSE GOTO "RunMcAfee" ENDIF ELSE IF $repeat=6 GOSUB "WriteKey" GOTO "END" ENDIF GOTO "END" ENDIF ; If they chose to save their choice, we write the registry key :WriteKey $newKey = ADDKEY($regValue) IF $newKey = 0 WRITEVALUE($regValue,"","$return",REG_SZ) IF @ERROR = 0 RETURN ELSE $errVal = MESSAGEBOX("The system was unable to create the necessary registry " + "value. Check to make sure you are using an account that " + "has Administrator rights to the computer you're using, " + "or contact the Help Desk for assistance at 972-883-2911." + " The error code generated was: " + @ERROR,"ERROR",16,60) RETURN ENDIF ELSE $errKey = MESSAGEBOX("The system was unable to create the necessary registry " + "key. Check to make sure you are using an account that " + "has Administrator rights to the computer you're using, " + "or contact the Help Desk for assistance at 972-883-2911." + " The error code generated was: " + @ERROR,"ERROR",16,60) RETURN ENDIF :END