Development‎ > ‎VBScript‎ > ‎

Adding routing rule from VBScript code

Another code page:
'*********************************************************************************
'* Function signature: FindNearestWeekday(sDayOfTheWeek, dDate)
'* Description: Function search for the date of the weekday which is nearest to
'*                the date passed as the second parameter.  
'*
'* Parameters
'* sDayOfTheWeek - weekday name (e.g. Monday, Tuesday, Wednesday)
'* dDate - VBScript date 
'*
'* Return Value
'* Date of the weekday which is nearest to the date passed as the dDate parameter
'*********************************************************************************
 
Function AddRouting(sDestination, sNetworkMask, sGateway)
       Dim oShell : Set oShell = CreateObject("Wscript.Shell")

       oShell.Run "route ADD " & sDestination & " MASK " & sNetworkMask & " " & sGateway, 1, True

       'Clean up
       Set oShell = Nothing
End Function

'Usage
AddRouting "192.168.4.0", "255.255.255.0", "192.168.0.1"
free hit counter

Comments