I have a GP that pushes this batch file and lspush to the users profile dir on their PCs.
The GP also creates a scheduled task when the PC is idle to run the batch file.
The users hardly every notice the script running. Since it only happens upon idle for 30mins (i.e. no input).
We use RDP alot so I didnt want it to run if it was in an RDP session or on our Termserv hosts.
We have our FW port fwding the Lansweeper port so it will work outside our firewall.
The only caveat is that the DNS lookup should resolve the fully qualified servername inside and outside your firewall. So you need to create an entry for your server on the local domain inside your NW and also with your DNS provider outside. So when you call lspush lansweeperserver.mydomain.com it works inside and outside your NW. I guess you could push a host entry for that if you wanted to or just have the entry on your DNS server depending on your setup.
This setup allowed me to scan remote clients w/o any agent or being on VPN with ease.
@ECHO OFF
CLS
ECHO IT Script Running
ECHO.
ECHO ---This should take less than 60 seconds---
EVENTCREATE /T INFORMATION /L APPLICATION /ID 100 /D "lspush.bat script started." > NUL 2>&1
PING -n 2 ls.mydomain.com |find "Reply from " > NUL 2>&1
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF ERRORLEVEL 1 goto :END
:SUCCESS
EVENTCREATE /T INFORMATION /L APPLICATION /ID 100 /D "lspush.bat script running." > NUL 2>&1
IF "%SESSIONNAME%" == "RDP-Tcp#0" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#1" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#2" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#3" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#4" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#5" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#6" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#7" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#8" GOTO END
IF "%SESSIONNAME%" == "RDP-Tcp#9" GOTO END
IF "%COMPUTERNAME%" == "TERMSERVHOST1" GOTO END
IF "%COMPUTERNAME%" == "TERMSERVHOST2" GOTO END
%USERPROFILE%\lspush.exe lansweeperserver.mydomain.com
EVENTCREATE /T INFORMATION /L APPLICATION /ID 100 /D "lspush.bat script ran." > NUL 2>&1
GOTO END
:END
CLS
EVENTCREATE /T INFORMATION /L APPLICATION /ID 100 /D "lspush.bat script finished." > NUL 2>&1
EXIT
---------------