I have 1/2 vbscript, anyone helps?

Intel / Xeon(tm) cpu 3.20ghz
January 12, 2009 at 05:58:17
Specs: Windows Server 2003, Xeon - 2G
Hi all,
Previously, I asked for a vbscript that does some certain job (I have the script of that job) after checking of connectivity with certain server and result of checking is positive, I found some script that creates a new function to check connection but I don't know how to integrate it with the job that I have. Below is what I need exactly then the script that checks connectivity.
I need the following:
1- check-1: Check connection with server-1
2- If it is possible to connect to server-1 then do Job-1
3- Whatever the result of check-1 do another check (check-2)
4- check-2: Check connection with server-2
5- If it is possible to connect to server-2 then do Job-2
6- If check-1 fails then repeat steps 1 & 2 after check-2
7- If check-2 fails then repeat steps 4 & 5 after check-1
8- The result is that there is a contiuous checking of any unconnected server, we have for example check-1 (false) then check-2 (false) then check-1 (true) then check-2 (false) then check-2 (false) then check-2 (true) then end, another example: check-1 (false) then check-2 (false) then check-1 (false) then check-2 (true) then check-1 (false) then check-1 (false) then check-1 (true) then end.
I know I'm asking for a lot but take it as a challeng, and if anyone completes this successfully then he does me a big favor.
Here is the script that I found which creates a function to check connectivity, I'm thanking who has done it and thank you all.

Function IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO)
' Returns True if strHost can be pinged.
' Based on a program by Alex Angelopoulos and Torgeir Bakken.
' Variables strTempFile, objShell, and objFSO have global scope
' and must be declared in the main program.
Dim objFile, strResults

If (intPings = "") Then
intPings = 2
End If
If (intTO = "") Then
intTO = 750
End If

Const OpenAsDefault = -2
Const FailIfNotExist = 0
Const ForReading = 1

objShell.Run "%comspec% /c ping -n " & intPings & " -w " & intTO _
& " " & strHost & ">" & strTempFile, 0, True

Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _
FailIfNotExist, OpenAsDefault)
strResults = objFile.ReadAll

Select Case InStr(strResults, "TTL=")
Case 0
IsConnectible = False
Case Else
IsConnectible = True
End Select
End Function

See More: I have 1/2 vbscript, anyone helps?

Report •

January 12, 2009 at 07:21:53
i dont know vbs.

but here is the pseudocode:
Dim server1, server2

if isConnectible(server1,"","")=true then
'do job1
end if

if isConnectible(server2,"","")= true then
'do job2
end if
wscript.wait(5000)'sleep for 5seconds
loop while true=true 'dont know your end condition

Report •
Related Solutions

Ask Question