Check Server Network Availablity with a VBScript Ping

There are lots of occasions where it’d be handy to know if a server (or servers) is even up before we try to execute a command on them. Often, a script will fail to execute properly or run until it times out because the server we are trying to access or run a command on, simply isn’t network accessible. It might be down, firewalled, hung, or for some other inexplicable reason you just can’t access it.

There are a few ways to check if a server is online but often I find myself just “pinging” a box to see if it responds. Well since I do this so often I decided that I’d write it up as a function so that I could just check to see if a server “IsPingable()” and save myself the hassle of using some other functionality.

This function will return “TRUE” if the server is ping-able and “FALSE” if it’s not. So we could do something like “If IsPingable(myServer) Then” do some work “Else Goto 0”. Pretty easy huh? Here is the function:

 

 

Leave a Comment