→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Luis89
Engaged Sweeper II
Hello,

I follow the instructions on how to make a .vbs script for LSPUSH for a OU. This works great IF we are hardwired and VPN before logging into Windows. Since our environment are all laptops this is not feasible because user are mobile and connect via wireless. Has anyone worked with a similar environment in where they can run LSPUSH as the user once they are logged in and vpn? Currently I have LSPUSH running as a task scheduler but this is not good as it does not capture the logged in users software.

Any help/tips would be appreciated.

-Luis
1 ACCEPTED SOLUTION
mark_roberts
Engaged Sweeper II

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
---------------

View solution in original post

2 REPLIES 2
Luis89
Engaged Sweeper II
Thanks Mark!

I will work on this over the weekend and test it! Much appreciated.

-Luis
mark_roberts
Engaged Sweeper II

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
---------------

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now