cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Anonymous
Not applicable
Well, on our environment we don't have the messenger service enabled at all, so it may be hard to comunicate with the user of a computer. With some AutoIT scripting and Lansweeper it's quite easy to manage a solution. Here it is, a custom action to do it...

send.au3
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)

TCPStartup()
Dim $szServerPC = $cmdline[1]
Dim $szIPADDRESS = TCPNameToIP($szServerPC)
Dim $nPORT = 5555
Dim $ConnectedSocket = -1

While $ConnectedSocket = -1
$ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)
WEnd

Dim $szData

If @error Then
MsgBox(4112, "Error", "TCPConnect failed with WSA error: " & @error)
Else
While 1
$szData = InputBox("My NetSender!", @LF & @LF & "Enter text to send to " & $cmdline[1] & "(" & $szIPADDRESS & "):")
$szData = $szData

If @error Or $szData = "" Then ExitLoop

TCPSend($ConnectedSocket, $szData)

If @error Then ExitLoop
WEnd
EndIf


receive.au3
#include <GUIConstants.au3>
#include <Constants.au3>
Opt("TrayIconHide", 1)

Dim $szIPADDRESS = @IPAddress1
Dim $nPORT = 5555

TCPStartUp()

$MainSocket = TCPListen($szIPADDRESS, $nPORT)

If $MainSocket = -1 Then Exit

Dim $ConnectedSocket = -1

Do
$ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1

Dim $szIP_Accepted = SocketToIP($ConnectedSocket)

Dim $msg, $recv

While 1
$msg = GUIGetMsg()
$recv = TCPRecv( $ConnectedSocket, 2048 )

If @error Then ExitLoop

if $recv <> "" Then MsgBox(262208,"Message",$recv)

WEnd


If $ConnectedSocket <> -1 Then TCPCloseSocket( $ConnectedSocket )

TCPShutDown()

Func SocketToIP($SHOCKET)
Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
"ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
If Not @error And $aRet[0] = 0 Then
$aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
If Not @error Then $aRet = $aRet[0]
Else
$aRet = 0
EndIf

$sockaddr = 0

Return $aRet
EndFunc


compile both scripts, you'll need psexec.exe as well, and use the following custom action commands on Lansweeper console:
cmd.exe /K \\server\share$\Lansweeper\psexec.exe \\{computer} -c -s -i \\server\share$\Lansweeper\receive.exe | \\server\share$\Lansweeper\send.exe {computer}


Well not much science on this one, but it works as expected so far, and doesn't depend on the annoying messenger service.
13 REPLIES 13
trs
Engaged Sweeper
thanks for sharing worked veary well
tdewar1
Engaged Sweeper
Does this script still work with the latest version of Auto IT? I tried to use it and I seem to be getting compiling errors.
Anonymous
Not applicable
Yes it's like you said, but that's not a problem either, if you close the send.exe the message will still be there on the remote computer until someone clicks ok... so it works as expected in my opinion. 😉
76012
Engaged Sweeper II
Nice! I notice Receive.exe does not exit until the remote user clicks the OK button. That's helpful to know they acknowledged your text, but not so much if you just want to leave a message on their screen...

Thanks for sharing.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now