cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mark_roberts
Engaged Sweeper II
Hi All,

I thought I would share a batch file I wrote to scan remote PCs using lspush.

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.
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. 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 ls.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
---------------
0 REPLIES 0