cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mrmcfu
Engaged Sweeper
Hello -

Is there some kind of way to generate a popup or confirmation on the user's desktop when the lsremote tool is invoked? Our Service Desk is extremely nervous about using this feature without user confirmation.

Best,
MrMcFu
11 REPLIES 11
Hemoco
Lansweeper Alumni
Please try this beta : http://www.lansweeper.com/forum/yaf_postst3052_Remote-control-30-beta.aspx
Anonymous
Not applicable
Yes, it's very simple to do that, just change this on lslocal.au3 (not tested):
Case $recv = "yes"
Msgbox(0,"Answear", "The user accepted connection")
MakeConnection()
Case $recv = "no" Or $recv = "timeout"
Msgbox(0,"Answear", "The user did not accepted connection")
Exit

But I find this quite annoying!
abolus
Engaged Sweeper
is it possible to have a return confirmation message from expert if the user accecpt or denied the notification for remote access?
Anonymous
Not applicable
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
mrmcfu
Engaged Sweeper
Sure that would be great!
Anonymous
Not applicable
I did what you've suggested, but it's much slower than my previous solution. I've also implemented the funcionality: if user is not logged on (login window on the pc) it does not ask to connect, if user does not answer after 30s, then it automatically declines connection.

I can post the autoit code if it fits your needs.
mrmcfu
Engaged Sweeper
Yeah I ended up using psexec - I try to keep the same method so that the scripts are easier to maintain:

First script -

-------------------------------------------

On error resume next

compstr = wscript.arguments(0)
verify = MsgBox("Please confirm you wish to lock the desktop of " & compstr,vbYesNo, "Lock Computer")

If verify = vbNo Then
wscript.quit
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
strFilePath = "\\LANSWEEPERSERVERSHARE\remote_lock.vbs"
strDestination = "\\" & compstr & "\c$\"
Set objFileCopy = objFSO.GetFile(strFilePath)

objFileCopy.Copy(strDestination)

set WshShell = WScript.CreateObject("WScript.Shell")
return = WshShell.Run("%comspec% /c \\LANSWEEPERSERVERSHARE\psexec.exe \\" & compstr & " -i wscript.exe c:\remote_lock.vbs",0,True)

Set objFileDel = objFSO.GetFile("\\" & compstr & "\c$\remote_lock.vbs")
objFileDel.Delete

------------------------------------

Second Script:

----------------------------------------

On Error Resume Next

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

------------------------------------------
Anonymous
Not applicable
Using nircmd from www.nirsoft.net you can do that, although it will lock the workstation after until 1 minute this way:
nircmd.exe remote copy \\{computername} lockws


but if you use psexec you can lock it right away...
mrmcfu
Engaged Sweeper
Nice. Looks like you can program. I pretend to program by writing scripts, so anything you can translate from my .vbs scribbles into decent code would be awesome.

I just finished another similiar script that locks the workstation remotely and I'll post it tomorrow.