Skip navigation

JSI Tip 9875. How can I send a pop-up message to every available computer in my domain, even if the messenger service is disabled?

Windows XP and Windows Server 2003 contains MSG.EXE, a command-line tool to send a message to a user.

When you type MSG /?, you receive:

Send a message to a user.

MSG \{username | sessionname | sessionid | @filename | *\}
    \[/SERVER:servername\] \[/TIME:seconds\] \[/V\] \[/W\] \[message\]

  username            Identifies the specified username.
  sessionname         The name of the session.
  sessionid           The ID of the session.
  @filename           Identifies a file containing a list of usernames,
                      sessionnames, and sessionids to send the message to.
  *                   Send message to all sessions on specified server.
  /SERVER:servername  server to contact (default is current).
  /TIME:seconds       Time delay to wait for receiver to acknowledge msg.
  /V                  Display information about actions being performed.
  /W                  Wait for response from user, useful with /V.
  message             Message to send.  If none specified, prompts for it
                      or reads from stdin.
Using only standard commands, and sub-routines that use only standard commands, I have scripted SendMsg.bat to send a message to every available computer in the domain that you are logged into.

The syntax for using SendMsg.bat is:

SendMsg "Message"

Where Message is the text that you wish to send.

NOTE: SendMsg.bat uses CMPAvail.bat and ADComp.bat, which must be located in your PATH, or in the same folder as SendMsg.bat.

SendMsg.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: SendMsg "Message"&goto :EOF
if \{%2\} NEQ \{\} @echo Syntax: SendMsg "Message"&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
set message=%1
set message=%message:"=%
for /f "Tokens=1 Delims=;" %%a in ('call adcomp') do (
 set comp="%%a"
 call CMPAvail !comp! Status
 if "!Status!" EQU "Y" msg * /server:!comp! %message%
)
endlocal



Hide comments

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.
Publish