Page 1 of 1 1
Topic Options
#58372 - 2001-08-20 10:14 PM Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Actually this question is open for anyone, but I know that Shawn posted some code for this a couple of weeks ago, and I can not seem to search/hunt it down.

I want a "native" (no external tools) method of sending to an NT Global group (or the equivalent) that must work on:
Windows 95/98/ME/NT/2000/XP and across both LAN/WAN, but need not work across Domains.

Here are articles I was able to find, but not the one posted by Shawn (which as I recall looked like it would work, just did not need it at the time... Isn't that the way it always goes - as soon as you lose it or give it away, you want it again.)

1.
NET Send to members of NT Groups http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=000007

2.
Sending NET Messages to multiple recipients http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=001008

3.
NET SEND to a group http://www.jsiinc.com/SUBB/tip0700/rh0757.htm
(this code will not work on Windows 9x)

4.
NET SEND a text file http://www.jsiinc.com/SUBC/tip1000/rh1024.htm
(this code will not work on Windows 9x)

5.
How do I send a message to a list of users? http://www.jsiinc.com/SUBB/tip0600/rh0660.htm

6.
"NET SEND" to Windows 2000-Based Computer May Not Succeed - Article ID: Q263464 http://support.microsoft.com/support/kb/articles/Q263/4/64.ASP


I suppose I could read a file from the @LDRIVE to get the names from a text file...

[ 20 August 2001: Message edited by: NTDOC ]

Top
#58373 - 2001-08-20 10:35 PM Re: Shawn - Help! - NET SEND to Group
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
NTDOC -
I believe the only way a 'native' process will work is by installing 'winpopup' on the Win9x clients. This should allow proper operation of net send from the command line.
As for sending to a group - the links you posted seem to have that covered.

Are you envisioning sending from each client, or to each client?

Bill

Top
#58374 - 2001-08-20 10:53 PM Re: Shawn - Help! - NET SEND to Group
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Doc

I was helping MikeT (mostly offline) and he ended-up posting his script here (end of thread) ...
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=002001

It sends a message to a list of hostnames in an INI file like this ...

[hostnames]
dn1cna=1
dn1cnb=1
dn1cnc=1
...

Is dis da one you were tinking of ?

-Shawn

Top
#58375 - 2001-08-20 11:26 PM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Shawn:
No, that is not the one, but it looks like I can get what I want from it. Thanks


Bill:
I have the WinPopUp covered already
Configuring WinPopUp for Windows 9x Clients by NTDOC
I am looking for a way so that when a client logs in and I do some Reg checks, if the machine
does not have what I am looking for, it will shell out and do a NET SEND to a group of people responsible for that piece of software.

I will look at taking the MACHINE NAME code that Shawn referenced and hopefully use USER NAMES instead to accomplish this task.
So, yeah, from each client (if there not in compliance). Can't get these other Admins to read and respond to the log file that I generate, so I figured I would bug the hell out of them till they go fix it.

I just need to practice with the LOOP and READ type stuff, I have seen the code around, just have not tried to implement it myself yet.

Top
#58376 - 2001-08-20 11:31 PM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Shawn, you were right, Same guy, just a different post...

Here is the one I was thinking of:
SendMessage to a list of machines

Top
#58377 - 2001-08-20 11:35 PM Re: Shawn - Help! - NET SEND to Group
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Doc,

While not a KIX solution, Eric, the guy I work with on Win-Scripts has put together a script that does this.

CTXTOOLS.ZIP

I know there is a fundamental difference between TSE and NTS, where TSE it is easier to send to a group of people. The problem I always came up with is that when a message was sent, it went to everybody on the domain.

- Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#58378 - 2001-08-21 12:05 AM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
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
#58379 - 2001-08-21 12:12 AM Re: Shawn - Help! - NET SEND to Group
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
NTDOC -
I use NAI - if errors encountered updating definition files at login I send email to defined IT group. POSTIE.EXE resides in netlogon share on all DC's, and command line very simple. How about that solution?
Bill

[ 21 August 2001: Message edited by: bleonard ]

Top
#58380 - 2001-08-21 12:40 AM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Yeah that may be a possible solution also. I was thinking of using the MAPIsend tool from MS, but have not looked that far in to it. I would not want our users to be able to use it as an Anonymous mailer from our company...

Send me more information on what you have so I can take a look at it.

The NET SEND can be quite an annoying tool unlike the email where the Admin can ignore it. If I could control the email better it would probably be a good solution also though. Having both working solutions would be great.

Thanks Bill

[ 21 August 2001: Message edited by: NTDOC ]

Top
#58381 - 2001-08-21 03:11 AM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Ok, I got the code working. Now to clean it up some and add other checking functionality.

I'll post the final code update later on.

Thanks everyone

Top
#58382 - 2001-08-21 04:16 AM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
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
#58383 - 2001-08-21 06:19 AM Re: Shawn - Help! - NET SEND to Group
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Doc,

If you need POSTIE -
http://download.cnet.com/downloads/0-3356723-100-902918.html?tag=st.dl.10001-103-1.lst-7-2.902918

As POSTIE is shareware, you could use BLAT..

BLAT is available from - http://www.interlog.com/~tcharron/blat.html

According to the following page - http://pages.infinit.net/che/blat/blat.html it looks like the efforts are being merged together.

HTH,

- Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#58384 - 2001-08-21 10:47 AM Re: Shawn - Help! - NET SEND to Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Thanks for the info Kyder,

I downloaded the latest version of BLAT and will take a look at it.

Question:
How do you prevent users from using it as an Anonymous emailer?
We have users from DUNCE to Phd.
If I set this up I'm afraid some of the smarter users will start using it as an Anonymous emailer since we already sit behind a firewall that makes an email hard to track down were it not for the name.
If they add a bogus name won't it be pretty hard to track down who or where it really came from?

Top
#58385 - 2001-08-21 11:38 AM Re: Shawn - Help! - NET SEND to Group
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
To your question NTDOC;

Perhaps by settings NTFS rights on that file, and calling it via SU could do the trick?

(SU start of course *.bat->*.exe'd and, encrypted)?

2 cents, Masken

_________________________
The tart is out there

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.067 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org