Header Ads

VB Scripting Code to ping other computer

This is a sample code how to network with other computer.This will automatically open up the command prompt and ping to the particular machine.
For combating the Network latency and delay I have used some delay in the programming too.
This is mostly applicable to networking team and those who use com/dcom.


Our client went to massive machine cut and port utilization.Among all the machines the below written code gave the report which is active and which has gone.
Parameterize the list and you are done.






Set oWshShell = CreateObject("wscript.Shell")
Cmd = "ping 58.2.122.76"


Set oExec = oWshShell.Exec(Cmd)
Do While oExec.Status = 0
WScript.Sleep 60
Loop


0utput= oExec.StdOut.ReadAll
error_code = oExec.StdErr.ReadAll
MsgBox "Output: " & output & vbNewLine & vbNewLine & "Errors: " & error_code



Well, where else you can use this concept??

  • There may be situation where you need to run your scripts in different machines.In this scenario you don't need to test if all the machines. This script can help you to test all the cases.
Powered by Blogger.