Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2008 01:15 AM
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
receive.au3
compile both scripts, you'll need psexec.exe as well, and use the following custom action commands on Lansweeper console:
Well not much science on this one, but it works as expected so far, and doesn't depend on the annoying messenger service.
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.
Labels:
- Labels:
-
Custom Actions
13 REPLIES 13

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2008 06:38 PM
thanks for sharing worked veary well

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2008 07:56 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2008 07:40 PM
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. 😉

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2008 06:48 PM
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.
Thanks for sharing.
