[Samba] Winpopup message to all user on a PDC

Robert Styma stymar at agcs.com
Wed Jul 2 14:42:18 GMT 2003


>
> Il 01/07/2003, alle ore 14:19, Roberto Samarone Araujo (RSA) ha scritto:
>
> >        It it possible to send messages to all users logged in a PDC at
same
> > time ?
>
> I didn't find a ready-to-use program, so I use something like this
> inside an executable script:
>
>     for i in $(cat /path/clientlist.txt)
>     do
>       echo message_text | smbclient -M $i &
>     done
>
> clientlist.txt is an ASCII file containing a list of all NetBIOS names
> of the PCs in the network, e.g.:
>
> ACCOUNTING
> JOHN
> BILL_PC
> SHARED
> etc...
>
> message_text is the text you want to send.
>
> --
> Ciao,
>   Marco.
In the above example, you can generate a list of the machine names
(/path/clientlist.txt) on the fly with the following sed script.
The script is all one line even though the mailer will wrap it.

smbstatus | sed -e
"1,4d"  -e"s/^[^ ][^ ]*[ ][ ]*[^ ][^ ]*[ ][ ]*[^ ][^ ]*[ ][ ]*[^ ][^ ]*[ ][ 
]*\([^ ][^ ]*\).*/\1/"   -e '/^$/,$d'

By the way, the sed script reads,
1.  Delete the first 4 lines
2.  Throw away everything but the 5th word from each line.
3.  Delete all the lines after you hit a blank line (not counting the first
4
    which were already thrown away.




More information about the samba mailing list