Lansweeper logo
Home Download Features Demo Buy now Help Support forum
 
    Most requested support articles:
  Lansweeper troubleshooting guide.
  The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
  WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  How to configure the windows firewall using group policies.
  Support:  
 support@lansweeper.com  
Skype: Lansweeper  
  Mo-Fri 9h-17h CET  
Welcome Guest Search | Active Topics | Log In | Register

Untag as favorite
List user network drives. Finally Working.
itssn
#1 Posted : Thursday, May 27, 2010 9:06:21 AM

Rank: Premium user

Groups: Premium Users
Posts: 13
Location: Latvia
Made this using owexec.exe, which makes possible to execute scripts on remote computer using user account username and password.

You can download owexec.exe at http://officewarfare.net/index.php/owexec/

Make two bach files; run.bat and getNetUse.bat and place them into lansweeper actions share, see below:

-------------run.bat---------------
Code:
@echo off

\\%LANSWEEPER ACTIONS SHARE%\owexec -nowait -k "%LANSWEEPER ACTIONS SHARE%\getNetUse.bat" -copy -c %1

:CHEK
if exist "\\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt" (
type \\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt
del \\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt
pause

) else (
@ping -n 5 -w 1000 0.0.0.1 > NUL
GOTO CHEK
)


------------getNetUse.bat-------------
Code:
@echo off
REM get net use
net use > \\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt



The 'temp' folder must have full acces to all user accounts (Domain users), because owexec will copy there NetUse.txt from user computer.

In Lansweeper console make new custom action with action

Code:
{actionpath}run.bat {computer}


Tested on XP and Vista with Lansweeper 4.0

One thing I dont like, is CMD window showing on user side for a second, maybe someone can suggest how to avoid it.

Thanks, Jo from http://officewarfare.net/index.php/owexec/ for an idea :)
techdesign
#2 Posted : Tuesday, October 26, 2010 8:42:21 PM
Rank: Freeware user

Groups: Member
Posts: 1
Location: Ogden, UT
I was able to get this to work without the popup by using an intermediate vbscript file that launches the batch file hidden. I'm sure this could be made even better if someone rewrote it to just use vbscript to dump the network drive letter and path, but coming up with this made me break out in a sweat as it is.

Here is the "batchlauncher.vbs" file (I found it in an old newsgroup post from a 'Torgeir Bakken'...thanks!)
Code:
sTitle = "Batch launcher"

Set oArgs = WScript.Arguments
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

If oArgs.Count <> 1 Then
' Will die after 10 seconds if no one is pressing the OK button
oShell.Popup "Error: You need to supply a file path " _
& "as input parameter!", 10, sTitle, vbCritical + vbSystemModal

Wscript.Quit 1
End If

sFilePath = oArgs(0)

If Not oFSO.FileExists(sFilePath) Then
' Will die after 10 seconds if no one is pressing the OK button
oShell.Popup "Error: Batch file not found", _
10, sTitle, vbCritical + vbSystemModal

Wscript.Quit 1
End If

' add quotes around the path in case of spaces
iRC = oShell.Run("""" & sFilePath & """", 0, True)

' Return with the same errorlevel as the batch file had
Wscript.Quit iRC


I then modified the run.bat command as follows:
Code:
@echo off

\\%LANSWEEPER ACTIONS SHARE%\owexec -nowait -k "wscript.exe" -p "\\%LANSWEEPER ACTIONS SHARE%\batchlauncher.vbs \\%LANSWEEPER ACTIONS SHARE%\getNetUse.bat" -c %1

:CHEK
if exist "\\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt" (
type \\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt
del \\%LANSWEEPER ACTIONS SHARE%\temp\NetUse.txt
pause

) else (
@ping -n 5 -w 1000 0.0.0.1 > NUL
GOTO CHEK
)


In the tests I've done, this achieves the exact same function, but without the command prompt window popping up momentarily.
Users browsing this topic
Guest
Untag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Contact: E-mail Lansweeper - Skype : Lansweeper
Copyright 2004 - 2011 © Hemoco bvba