Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


"How to" Ping form Excel List

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,48847
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "How to" Ping form Excel List
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 "How to" Ping form Excel List - 6/28/2007 1:39:59 AM   
  SiyBlue

 

Posts: 2
Score: 0
Joined: 6/28/2007
From: VA
Status: offline
I have been working with VBS only for about a month now.  I have been working on this particular script for a few days.
 
What I am trying to do.
Ping a list of IP addresses for an Excel file. The IP addresses are in column A and start on row 2.
           
Then I would like the results of the pings placed back in to the same Excel file if possible, or at the least a .txt.  As you can see I have not got around to that part yet.
 
I was unable to find and information about such a of script here or google. Most every thing on google that is close has to do with creating AD users.
 
I really don’t know were to go form here and any help would be greatly appreciated.
 
 
 
 
 
 
 
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("H:\test\MFP Ping.xls")
 
'******************************************************************
 
strComputer = "."
Set objWMIService = GetObject(_
    "winmgmts:\\" & strComputer & "\root\cimv2")
 
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
 
 
 
Set colPings = objWMIService.ExecQuery _
    ("Select * From Win32_PingStatus where Address = 'objExcel.Cells(intRow,1).Value'")


 
For Each objStatus in colPings
    If IsNull(objStatus.StatusCode) _
        or objStatus.StatusCode<>0 Then
        WScript.Echo "Computer did not respond."
    Else
        Wscript.Echo "Computer responded."
    End If
Next
intRow = intRow + 1
loop
 
 
Post #: 1
 
 RE: "How to" Ping form Excel List - 6/28/2007 2:55:45 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Searching this site for Ping and Excel, I found that the Frequently Asked Stuff thread (http://www.visualbasicscript.com/m_47117/tm.htm) addresses pinging and accessing data in Excel.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to SiyBlue)
 
 
Post #: 2
 
 RE: "How to" Ping form Excel List - 6/28/2007 11:34:30 AM   
  dm_4ever


Posts: 2396
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
Try changing your Set colPing to....


Set colPings = objWMIService.ExecQuery _
   ("Select * From Win32_PingStatus where Address = '" & _
   objExcel.Cells(intRow,1).Value & "'")

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to SiyBlue)
 
 
Post #: 3
 
 RE: "How to" Ping form Excel List - 6/28/2007 11:51:55 PM   
  SiyBlue

 

Posts: 2
Score: 0
Joined: 6/28/2007
From: VA
Status: offline
Thanks for the help.  That did it. I appreciate it.

(in reply to SiyBlue)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "How to" Ping form Excel List Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts