Ok, there are 2 helper components:
lslocal.au3:
Opt("TrayIconHide", 1)
Global $MainSocket, $szIPADDRESS, $nPORT
Dim $szServerPC = @ComputerName
Dim $szIPADDRESS = TCPNameToIP($szServerPC)
Dim $ConnectedSocket = -1
Dim $nPORT = 5555
$MainSocket = TCPListen($szIPADDRESS, $nPORT)
If $MainSocket = -1 Then
Exit
EndIf
While 1
$ConnectedSocket = TCPAccept($MainSocket)
If $ConnectedSocket >= 0 Then
While 1
$recv = TCPRecv($ConnectedSocket, 2048)
If @error Then ExitLoop
Select
Case $recv = "yes"
MakeConnection()
Case $recv = "no" Or $recv = "timeout"
Exit
EndSelect
WEnd
EndIf
WEnd
Dim $msg, $recv
If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket)
Func OnAutoItStart()
TCPStartup()
EndFunc ;==>OnAutoItStart
Func OnAutoitExit()
TCPCloseSocket($ConnectedSocket)
TCPShutdown()
EndFunc ;==>OnAutoitExit
Func MakeConnection()
Run(@ScriptDir & "\lsremote.exe " & $cmdline[1], @ScriptDir)
Exit
EndFunc ;==>MakeConnection
lsremoteh.au3:
Opt("TrayIconHide", 1)
TCPStartup()
Dim $szServerPC = $cmdline[1]
Dim $szIPADDRESS = TCPNameToIP($szServerPC)
ConsoleWrite($szIPADDRESS)
Dim $nPORT = 5555
Dim $ConnectedSocket = -1
$ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)
If ProcessExists("explorer.exe") Then
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262180, "Remote Control", "Would you like Service Desk to take control of your machine?", 30) ;Timeout of 30s defined
Select
Case $iMsgBoxAnswer = 6 ;Yes
TCPSend($ConnectedSocket, "yes")
Exit
Case $iMsgBoxAnswer = 7 ;No
TCPSend($ConnectedSocket, "no")
Exit
Case $iMsgBoxAnswer = -1 ;Timeout
TCPSend($ConnectedSocket, "timeout")
Exit
EndSelect
Else
TCPSend($ConnectedSocket, "yes")
Exit
EndIf
Func OnAutoItStart()
TCPStartup()
EndFunc ;==>OnAutoItStart
Func OnAutoItExit()
TCPCloseSocket($ConnectedSocket)
TCPShutdown()
EndFunc ;==>OnAutoItExit
The action should be:
cmd /c \\server\share$\Lansweeper\psexec.exe \\{computer} -i -s -c -f \\server\share$\Lansweeper\lsremoteh.exe %computername%| \\server\share$\Lansweeper\lslocal.exe {computer}
lsremote.exe should be on the same share as lsremoteh.exe and lslocal.exe