JSI Tip 0757. NET SEND to a group.

In tip 660, we used batch files to NET SEND to multiple users. To NET SEND to a group, we can use the public domain SHOWMBRS program and batch SNDGRP.

Syntax:  SNDGRP "DomainName\GroupName" "message"

Sample: SNDGRP "JSI\Accounts Payable" "Don't forget Friday's check run."

SNDGRP.bat contains:

@echo off
If %1

"" goto syntax If %2

"" goto syntax set group=%1 set message=%2 set work=#####%message%##### set work=%work:#####"=% set message=%work:"#####=% set message=%message:#####=% for /f "tokens=1* delims=:" %%i in ('time /t') do set HH=%%i&set MM=%%j set $tok=1-3 for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u if "%$d1:~0,1%" GTR "9" set $tok=2-4 for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do ( for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do ( set %%x=%%u set %%y=%%v set %%z=%%w set $d1= set $tok=)) set TDYY=%yy% set TDMM=%mm% set TDDD=%dd% set log=%temp%\sg%TDYY%%TDMM%%TDDD%.%HH%%MM% if exist %log% del /q %log% @echo sndgrp - %group% - %message% set group=%1 set message=%2 for /f "Skip=2 Tokens=* Delims= " %%i in ('showmbrs %group%') do call :msg "%%i" for /f "Tokens=*" %%i in ('type %log%') do set line=%%i&call :who del /q %log% endlocal goto :EOF :syntax @echo Syntax: SNDGRP "Group Name" "message" endlocal goto :EOF :who if /i "%line:~0,28%" EQU "The message was successfully" @echo %line% goto :EOF :msg set name=%1 net send %name% %message% >> %log% 2>>&1

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.