cancel
Showing results for 
Search instead for 
Did you mean: 

How to Detect slow network connection

Johanvdv
Level 4

We have a working BESR 8.5 with management solution installation on our site.

Our Windows 7 or Windows XP clients are backed up on a daily basis to a central backup server.

 

Problem is that when our employees are out of the office, they report that the backup executes when they are connected using the VPN (broadband internet and a Juniper SSL VPN connection with Network Connect option).

 

Is there a way to skip the execution of a backup job when a 'slow network' is detected ?

I have not been able to find any option in the interface that would allow me to specify a mimimum speed on the connection for a backup to start.

Creating a before capture script sounds like the only option available.

 

Is there someone out there who has resolved a similar situation or who handles this problem using other techniques ?

I have also looked into the functionality provided by SSR 2011 and could not find a different solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Johanvdv
Level 4

I have created a solution myself that works for our environment (BESR 8.5.x clients with management component).

To this end, I have created a backup job that has the following batch file executed in the before data capture event :

 

 

I had to add a helper .vbs script so the Add file filter was to be put to *.* in order to upload the this file.

The check-speed.bat file currently contains the following code :

 @ECHO OFF
echo START >>"%~dp0check-speed.log"
echo Executing ["%~dp0script-short.vbs"] >>"%~dp0check-speed.log"

cscript //nologo "%~dp0script-short.vbs" 1>>"%~dp0check-speed.log" 2>>&1
rem cscript //nologo script.vbs 1>>c:\Log.txt 2>>&1
IF ERRORLEVEL 1 GOTO LOW-SPEED
IF ERRORLEVEL 0 GOTO LOCAL

:LOW-SPEED
ECHO Connected to a low-speed network (VPN) so cancel the backup >>"%~dp0check-speed.log"
EXIT /B 1
GOTO END

:LOCAL
ECHO Connected to the local network so proceed with backup >>"%~dp0check-speed.log"
EXIT /B 0
GOTO END

:END
ECHO ending the check-speed in an undesired place >>"%~dp0check-speed.log"
EXIT /B 0 

The salient part is that this .bat file will call the .vbs script and depending on its outcome it will return an exit code to Backup Exec System Recovery.

If the exit code is not zero, then the before capture event failed and the backup job will also fail (no backup).

The .vbs script is something I found via Google (I have to give credit) that will enumerate all 'Network Adapters' and if a MAC address is assigned and the name of the Adapter contains 'JUNIPER' do a check wether this adapter is connected.

If it is connected, a return code of 1 is set.

I am using this test (there is definitely a better one around) as my VPN connection is of the SSL Juniper type and this adapter becomes active when a LAPTOP connects to our internal network using the Network connect option.

I could not do a reliable test on network speed as the 'fake' JUNIPER network connector reports the theoretical speed that is possible (1 Gbit) and not the actual internet speed. To get around this, I would have to run an internet connection speed test on every connection and this is beyond what I want to do here. 

 '  Set NIC.vbs
'  VBScript to check your network connection.
'  Author Guy Thomas http:// computerperformance.co.uk/
'  Version 4.9 - October 3th 2004
'  --------------------------------------------------------------'
Option Explicit
Dim objWMIService, ObjItem
Dim GuyMessage, strComputer, colItems
'On Error Resume Next
strComputer = "."

'   These Set commands are important.
'    See Learning Points after / below the script

Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapter",,48)

For Each objItem in colItems

If objItem.MACAddress <> "" and Instr(Ucase(objItem.Name),"JUNIPER") > 0 Then
' Remove objItem's that you do not want.
WScript.Echo "Name: " & objItem.Name & vbCRLf & _
"Net Connection ID: " & objItem.NetConnectionID & vbCRLf & _
"Net Connection Status: " & objItem.NetConnectionStatus & vbCRLf & _
"Computer Name: " & objItem.SystemName & vbCRLf & _
"Speed: " & objItem.Speed & vbCRLf & _
""
  if objItem.Netconnectionstatus = "2" then
     WScript.Echo "Connected via VPN using NC : OK." 
     WScript.Quit 1       
     If CDBl(objItem.speed) > 80000000 then
        WScript.Echo "Connection SPEED ? : OK."
        WScript.Quit 0
     else
        WScript.Echo "Connection SPEED ? : SLOW."
        WScript.Quit 1
     end if   
  else
     WScript.Echo "Connected via VPN using NC : NOT."    
     WScript.Quit 0
  end if 
   
End IF
Next

WScript.Quit 0 

 

 

 

View solution in original post

6 REPLIES 6

Markus_Koestler
Moderator
Moderator
   VIP   

For me too the pre command script seems to be the only solution.

 

But you could try also to set the network throttle, but this would limit the used bandwidth also when the client is NOT using the VPN.

Johanvdv
Level 4

Next to network speed (the incoming VPN bandwidth is limited) there is also the issue of volume transmitted.

Within our country, most internet service providers charge based on a maximum allowed volume of serveral GB's. When you start to send out an image that is several GB or compare your local disk's data with a previous backup image that is also several GB, you eventually run into problems.

My employees have an upload speed on average of 1Mbit and my office is limited to an upload speed of about 2Mbit. This means if I have employees running a BESR backup at the same time, it effectivily brings to a halt all internet connectivity for the other employees who are in the office.

I have started to look a bit deeper into the pre-command scripting : there is something strange going on with application paths.

On a Win7 system, the scripts are downloaded (via the package/management control) to the location : "C:\ProgramData\Symantec\Backup Exec System Recovery\CommandFiles".

You can only select .BAT and .EXE extensions in the interface but you can expand it using a *.* selection to other extensions (e.g. a .vbs for use with cscript).

The kicker is that the 'current path' of the pre-command script is c:\windows\system32 so this means that you have to explicitly specify a fixed locaton for all components (sub-scripts, logfiles, ...)

As I also have to support Windows XP, this sounds like 'a feature'. I would have expected the current directory to be the ...CommandFiles location.

Anyway : is it possible to use the Altiris layer for this in SSR 2011?

 

Markus_Koestler
Moderator
Moderator
   VIP   

Altiris layer for this in SSR 2011?

-->Yes and you can also manage BESR 8.5 using the Altiris Layer

Markus_Koestler
Moderator
Moderator
   VIP   

Do you have enough information to mark this post as solved ?

Johanvdv
Level 4

I have created a solution myself that works for our environment (BESR 8.5.x clients with management component).

To this end, I have created a backup job that has the following batch file executed in the before data capture event :

 

 

I had to add a helper .vbs script so the Add file filter was to be put to *.* in order to upload the this file.

The check-speed.bat file currently contains the following code :

 @ECHO OFF
echo START >>"%~dp0check-speed.log"
echo Executing ["%~dp0script-short.vbs"] >>"%~dp0check-speed.log"

cscript //nologo "%~dp0script-short.vbs" 1>>"%~dp0check-speed.log" 2>>&1
rem cscript //nologo script.vbs 1>>c:\Log.txt 2>>&1
IF ERRORLEVEL 1 GOTO LOW-SPEED
IF ERRORLEVEL 0 GOTO LOCAL

:LOW-SPEED
ECHO Connected to a low-speed network (VPN) so cancel the backup >>"%~dp0check-speed.log"
EXIT /B 1
GOTO END

:LOCAL
ECHO Connected to the local network so proceed with backup >>"%~dp0check-speed.log"
EXIT /B 0
GOTO END

:END
ECHO ending the check-speed in an undesired place >>"%~dp0check-speed.log"
EXIT /B 0 

The salient part is that this .bat file will call the .vbs script and depending on its outcome it will return an exit code to Backup Exec System Recovery.

If the exit code is not zero, then the before capture event failed and the backup job will also fail (no backup).

The .vbs script is something I found via Google (I have to give credit) that will enumerate all 'Network Adapters' and if a MAC address is assigned and the name of the Adapter contains 'JUNIPER' do a check wether this adapter is connected.

If it is connected, a return code of 1 is set.

I am using this test (there is definitely a better one around) as my VPN connection is of the SSL Juniper type and this adapter becomes active when a LAPTOP connects to our internal network using the Network connect option.

I could not do a reliable test on network speed as the 'fake' JUNIPER network connector reports the theoretical speed that is possible (1 Gbit) and not the actual internet speed. To get around this, I would have to run an internet connection speed test on every connection and this is beyond what I want to do here. 

 '  Set NIC.vbs
'  VBScript to check your network connection.
'  Author Guy Thomas http:// computerperformance.co.uk/
'  Version 4.9 - October 3th 2004
'  --------------------------------------------------------------'
Option Explicit
Dim objWMIService, ObjItem
Dim GuyMessage, strComputer, colItems
'On Error Resume Next
strComputer = "."

'   These Set commands are important.
'    See Learning Points after / below the script

Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapter",,48)

For Each objItem in colItems

If objItem.MACAddress <> "" and Instr(Ucase(objItem.Name),"JUNIPER") > 0 Then
' Remove objItem's that you do not want.
WScript.Echo "Name: " & objItem.Name & vbCRLf & _
"Net Connection ID: " & objItem.NetConnectionID & vbCRLf & _
"Net Connection Status: " & objItem.NetConnectionStatus & vbCRLf & _
"Computer Name: " & objItem.SystemName & vbCRLf & _
"Speed: " & objItem.Speed & vbCRLf & _
""
  if objItem.Netconnectionstatus = "2" then
     WScript.Echo "Connected via VPN using NC : OK." 
     WScript.Quit 1       
     If CDBl(objItem.speed) > 80000000 then
        WScript.Echo "Connection SPEED ? : OK."
        WScript.Quit 0
     else
        WScript.Echo "Connection SPEED ? : SLOW."
        WScript.Quit 1
     end if   
  else
     WScript.Echo "Connected via VPN using NC : NOT."    
     WScript.Quit 0
  end if 
   
End IF
Next

WScript.Quit 0 

 

 

 

View solution in original post

Markus_Koestler
Moderator
Moderator
   VIP   

Cool ! yes