We’re currently experiencing a high volume of support requests, which may result in longer response times — Thank you for your patience and understanding.
Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mbgritten
Engaged Sweeper
Hello,

We are using Lansweeper at work to monitor up to 500 laptops and PCs. However, we have an issue with our staff using their laptops at home when they are disconnected from the server.

On startup, the machines run the following VBScript:

Set WshShell = CreateObject("WScript.Shell")

WshShell.run "%logonserver%\netlogon\lsclient.exe lansweeper"

' ",0" = Window is hidden


...which then brings up an error if they are not connected to the server:

No network provider accepted the given network path.
Code: 800704B3


Could you please help me out with a fix to the VBScript that makes the VBScript run only if the server is present?

Many thanks,

Mark
7 REPLIES 7
Hemoco
Lansweeper Alumni
Try :

Set WshShell = CreateObject("WScript.Shell")

tempstr = WshShell.ExpandEnvironmentStrings("%logonserver%")
if tempstr <> "" then
WshShell.run "%logonserver%\netlogon\lsclient.exe lansweeper",0
end if
mbgritten
Engaged Sweeper
Hello,

The error message is as follows:

Windows Script Host

Script: C:\Program Files\xxx\LanSweeper.vbs
Line: 3
Char: 1
Error: No network provider accepted the given path.
Code: 800704B3
Source: (null)


...and the VBS file is:

Set WshShell = CreateObject("WScript.Shell")

WshShell.run "%logonserver%\netlogon\lsclient.exe lansweeper",0

' ",0" = Window is hidden


Many thanks,

Mark
Hemoco
Lansweeper Alumni
Could you give an example message of such an error?
mbgritten
Engaged Sweeper
Hello,

Thanks for the guidance on how to hide the window - it works very well.

However, as there is still an error message that appears (an alert window), it would be better if there was a way to make the script detect whether the machine was attached to the system and not run if the machine was operating off the network.

Any ideas with how to modify the scripting or how to achieve a solution that avoids error messages appearing every time the laptop runs disconnected from the network?

Thanks,

Mark
Hemoco
Lansweeper Alumni
The example was in your post:

' ",0" = Window is hidden

add ",0" at the end of your line

WshShell.run "%logonserver%\netlogon\lsclient.exe lansweeper",0
mbgritten
Engaged Sweeper
Hello,

Sorry - I'm not a VBScript wiz - could you indicate by including the code how I would go about doing this?

Many thanks,

Mark
Hemoco
Lansweeper Alumni
Why don't you add the parameters to make the window hidden?
This way it doesn't matter if they get an error.

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

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

Try Now