I came across this need to check the availability of multiple devises by pinging them , this script will preform ping to computers from a csv file and will create another CSV file with the computer name and true if it has ping false if it doesn’t
There are two script
1. Ping to Computer name
2. Ping to IP address
You will need to create a CSV file with the computer list and call it – “Complist.csv”
save it in the same folder with the script
the script will run on this file and create a new file called “complist-ping.csv”
Search by Computer name Script :
- Copy the text and save it as VBS
Function Ping(strHost)
Ping = False
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = ‘" & strHost & "’")
for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
Ping = False
else
Ping = True
end if
next
set objPing = nothing
End Function
set fs = CreateObject("Scripting.FileSystemObject")
set objfile = fs.OpenTextFile("complist.csv")
i = 0
Set mf = fs.CreateTextFile("complist-ping.csv",false)
do while not objfile.AtEndOfStream
arr2 = split(objfile.ReadLine,",")
if (ubound(arr2) <> -1) then
if (left(arr2(0),1) <> ";")and(left(arr2(0),1) <> "#") then
mf.writeline(arr2(0) & "," & cstr(Ping(arr2(0))))
i = i + 1
end if
end if
Loop
objfile.close
mf.close
set objfile = nothing
set fs = nothing
set wa = nothing
set objEnv = nothing
set objNetwork = nothing
wscript.echo "Done " & i
Search by IP Address
- Copy the text and save it as VBS
Function Ping(strIP)
Ping = False
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = ‘" & strIP & "’")for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
Ping = False
else
Ping = True
end if
next
set objPing = nothing
End Function
set fs = CreateObject("Scripting.FileSystemObject")
set objfile = fs.OpenTextFile("complist.csv")
i = 0
Set mf = fs.CreateTextFile("complist-ping.csv",false)
do while not objfile.AtEndOfStream
arr2 = split(objfile.ReadLine,",")
if (ubound(arr2) <> -1) then
if (left(arr2(0),1) <> ";")and(left(arr2(0),1) <> "#") then
mf.writeline(arr2(0) & "," & cstr(Ping(arr2(0))))
i = i + 1
end if
end if
Loop
objfile.close
mf.close
set objfile = nothing
set fs = nothing
set wa = nothing
set objEnv = nothing
set objNetwork = nothing
wscript.echo "Done " & i
Good luck ![]()

Sr. Cloud Solution Architect at Microsoft, I’m passionate about helping customers succeed by building secure, scalable, and innovative cloud solutions – with a strong focus on AI, DevOps practices, and end-to-end security. With a proven track record in the IT and services industry, I serve as a trusted advisor, partnering closely with organizations to guide them through digital transformation and maximize the value of their cloud investments.
My role combines technical leadership with project ownership – from designing modern architectures to leading cross-functional implementations that drive real business outcomes. I also manage and empower strategic partners, working hand-in-hand with them to ensure project success and deliver measurable business impact for customers.