Thursday 5 November 2009

Using messenger service to send Console messages

Yep sometimes we need to do that to inform the user that we are going to take over their machine (VNC etc). However the problem is on our imaged machines the messenger service is not running by default. So I got this script together. It will ask you for the remote IP address, ask your for the message to send, start remote messenger service, send the messege, then stop the remote messenger service.

Ofcourse you need admin rights on the remote machine. and also your local messenger service should be running as well.

here is the script:
just copy and paste save as a .bat file and run.




cd \
cls

REM sc start messenger

cls

REM ===========================================
REM ============Nadeem Sarwar==================

REM Script to send console message to specified
REM terminal. User inputs IP address and message
REM Will Only work if you have admin rights on
REM target PC.

REM ===========================================



@ECHO OFF

ECHO.
ECHO.
ECHO.

REM :BEGIN

echo Enter Target IP Address:
ECHO.

set /p Address=

ECHO.
ECHO.
ECHO.

echo Enter Message to Send:
ECHO.

set /p Message=


sc \\%Address% config messenger start= demand
sc \\%Address% start messenger

PAUSE

NET SEND %Address% "%Message%"


sc \\%Address% config messenger start= disabled

sc \\%Address% stop messenger

REM sc stop messenger

PAUSE




REM =======================================