
You can run “ping command“!
VBA Code
For example, run ping commando to host name “serverhost”.
Option Explicit
Sub sampleProc()
Dim objLocator As Object
Dim objServer As Object
Dim objPingSet As Object
Dim ping As Object
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objServer = objLocator.ConnectServer()
'Set "host name" or "IP address" as a condition
Set objPingSet = objServer.ExecQuery _
("Select * From Win32_PingStatus Where Address = 'serverhost'")
'Run ping command
For Each ping In objPingSet
Select Case ping.StatusCode
Case 0
MsgBox ("Success")
Case 11010
MsgBox ("failed【Timeout】")
Case 11003
MsgBox ("failed【Unreachable】")
Case Else
MsgBox ("failed")
End Select
Next
Set objLocator = Nothing
Set objServer = Nothing
Set objPingSet = Nothing
End Sub
Result
You ran “ping command“!

FYI
For more information about following, see the following official online manual:
●“ConnectServer method” of “SWbemLocator Object”
●“ExecQuery method” of “SWbemServices Object”
●Ping result details