#58378 - 2001-08-21 12:05 AM
Re: Shawn - Help! - NET SEND to Group
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Thanks for the info Kyder. I downloaded it and looked at it, however, I would really rather not have to copy any more files to the workstations if I can help it. Maybe I can use some of the ideas though on other things. Thanks again.Here is what I have so far, but I'm not quite up to par with some of you other programmer types.. code:
BREAK ON $PROFILE = "C:\SCRIPTS\NAVSUP.INI" $SECTION = "NAVSUPPORT" $CR = CHR(10) $LIST = READPROFILESTRING($PROFILE, $SECTION, "" )$RC = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\SharedDefs","NAVCORP_70") $RC = SUBSTR($RC,INSTR($RC,".")-8,8) $SendMsg = 'NET SEND $NAVSUP "NOTICE: @USERID (@FULLNAME) logged on to @WKSTA with an IP of @IPADDRESS0. This workstation has VIRUS definition files dated $RC which are over 90 days old. Please help @FULLNAME update the AntiVirus on this system"' ; Thanks go to Lonkero for this line, amazingly he took my 10+ lines of code and reduced it down to one... ; Kyder helped me extract the contents of the string to a useable manner. IF ((((@year-2000)*365)+@ydayno)-(((val(SUBSTR($RC,1,4))-2000)*365)+((val(SUBSTR($RC,5,2))-1)*30)+val(SUBSTR($RC,7,2))))>90 GOSUB ALERT ELSE ?"Your NAV Definitions are $RC" ENDIF ; Missing something here... No message is sent, but from command line to one user works. :ALERT WHILE INSTR ($LIST, $CR) <> 0 $NAVSUP = SUBSTR($LIST,1,INSTR($LIST,$CR)-1) SHELL $SendMsg $LIST = SUBSTR($LIST,INSTR($LIST,$CR)+1,LEN($LIST)-INSTR($LIST,$CR)) LOOP RETURN
Contents of NAVSUP.INI
code:
[NAVSUPPORT] sup-baf sup-eds sup-tld
Sending on the command line to one user works, so I must be messing up the variable some how. [ 21 August 2001: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#58382 - 2001-08-21 04:16 AM
Re: Shawn - Help! - NET SEND to Group
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Here is what I have so far... All seems to work during minor testing. Still need to test this on multiple clients and servers to verify functionality.code:
BREAK ON CALL "OSVER.KIX" $MCAFEE = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\virusscan","szVirDefVer") $PATTERN = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion","CurrentPatternName") $PARENT = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion","Parent") $SCANENGINE = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion","ScanEngineVersion") $SCANDEFS = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\SharedDefs","NAVCORP_70") $comment9x = READVALUE("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP", "Comment") $commentNT = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters","srvcomment")$PROFILE = "C:\SCRIPTS\NAVSUP.INI" $SECTION = "NAVSUPPORT" $CR = CHR(10) $LIST = READPROFILESTRING($PROFILE, $SECTION, "" ) $RC = "" $RC = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\SharedDefs","NAVCORP_70") $RC = SUBSTR($RC,INSTR($RC,".")-8,8) IF (EXISTKEY("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\NAVMSE") = 0) ;System is running NAV on an Exchange Server RETURN QUIT ENDIF IF $RC = "" GOTO ALERT2 GOTO LOGS ENDIF IF ((((@year-2000)*365)+@ydayno)-(((val(SUBSTR($RC,1,4))-2000)*365)+((val(SUBSTR($RC,5,2))-1)*30)+val(SUBSTR($RC,7,2))))>90 GOSUB ALERT1 GOTO LOGS ENDIF GOTO LOGS :ALERT1 WHILE INSTR ($LIST, $CR) <> 0 $NAVSUP = SUBSTR($LIST,1,INSTR($LIST,$CR)-1) SHELL '%COMSPEC% /C NET SEND "$NAVSUP" "NOTICE: @USERID (@FULLNAME) logged on to @WKSTA with an IP of @IPADDRESS0. This workstation has VIRUS definition files dated $RC which are over 90 days old. Please help @FULLNAME update the AntiVirus on this system"' $LIST = SUBSTR($LIST,INSTR($LIST,$CR)+1,LEN($LIST)-INSTR($LIST,$CR)) LOOP RETURN :ALERT2 WHILE INSTR ($LIST, $CR) <> 0 $NAVSUP = SUBSTR($LIST,1,INSTR($LIST,$CR)-1) SHELL '%COMSPEC% /C NET SEND "$NAVSUP" "WARNING: @USERID (@FULLNAME) logged on to @WKSTA with an IP of @IPADDRESS0. This workstation has NO AntiVirus installed. Please install immediately"' $LIST = SUBSTR($LIST,INSTR($LIST,$CR)+1,LEN($LIST)-INSTR($LIST,$CR)) LOOP RETURN :LOGS $LOGSRV = WDID02 IF @INWIN = 1 ; WinNT IF EXIST ("\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG") DEL ("\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG") ENDIF IF OPEN(1,"\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG", 5)= 0 $out = WriteLine(1, @DATE+"*"+@TIME+"*"+@USERID+"*"+@COMMENT+"*"+$commentNT+"*"+@FULLNAME+"*"+@lserver+"*"+@HOMEDIR+"*"+@HOSTNAME+"*"+@IPADDRESS0+"*"+@ADDRESS+"*"+@WKSTA+"*McAfee DEF*"+$MCAFEE+"*NAV Eng*"+$SCANENGINE+"*NAV7 DEF*"+$PATTERN+"*NAV7 Parenet Server*"+$PARENT+"*"+$os+"*"+$SCANDEFS+"*"+Chr(13)+Chr(10)) $nul = CLOSE(1) ENDIF ELSE IF EXIST ("\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG") DEL ("\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG") ENDIF IF OPEN(5,"\\"+$logsrv+"\LOGS\DIALIN\LAN\"+@WKSTA+"."+@ADDRESS+".LOG", 5)= 0 $out = WriteLine(5, @DATE+"*"+@TIME+"*"+@USERID+"*"+@COMMENT+"*"+$comment9x+"*"+@FULLNAME+"*"+@lserver+"*"+@HOMEDIR+"*"+@HOSTNAME+"*"+@IPADDRESS0+"*"+@ADDRESS+"*"+@WKSTA+"*McAfee DEF*"+$MCAFEE+"*NAV Eng*"+$SCANENGINE+"*NAV7 DEF*"+$PATTERN+"*NAV7 Parenet Server*"+$PARENT+"*"+$os+"*"+$SCANDEFS+"*"+Chr(13)+Chr(10)) $nul = CLOSE(5) ENDIF ENDIF RETURN
Special thanks to Lonkero, and Kyder for helping me with the String Manipulation portions of the code. I also had the format of the NAVSUP.INI wrong. I left off the NAME=USER1 and only had the NAME portion without the = Does anyone see any potential problems or further suggestions to improve this? Bill, please post further info on the POSTIE.EXE you are talking about. I just don't want to open an ANONYMOUS mailer for people...
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 640 anonymous users online.
|
|
|