Solved

System Status Script

Posted on 2006-06-21
3
191 Views
Last Modified: 2010-04-07
I know next to nothing about scripting...so let's get that out on the table first.  What I want is a script that when executed will ping the IP's of the devices I specify, 10 times each, say "Server 1" IP 10.0.0.1" and output the results to a file on the local computer, say named "NetworkStatus.txt" If there is no reply from any of pings, I want an email to be sent to my email address.  I know that this can be done, but I have no idea how.  Just for learning value (On my part obviously) I have included what I originally have done w/ a batch file:

@echo off
ping -n 10 10.0.0.1 >c:\networkstatus\server1.txt
ping -n 10 10.0.0.2 >c:\networkstatus\server2.txt
ping -n 10 10.0.0.3 >c:\networkstatus\server3.txt
copy c:\networkstatus\*.* c:\"documents and settings"\user.ccsdk12\desktop\status

This approach doesn't consolidate the data into one document, and doesn't notify of failed devices....Thank you kindly to all that respond!

jK
0
Comment
Question by:Jandakel2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 500 total points
ID: 16965041
Firstly if you use the >> operator instead, it will append to an existing file:


@echo off

SET LOGFILE=c:\networkstatus\Log.txt

echo Server Status >%LOGFILE%

ping -n 10 10.0.0.1 >>%LOGFILE%
ping -n 10 10.0.0.2 >>%LOGFILE%
ping -n 10 10.0.0.3 >>%LOGFILE%

copy %LOGFILE% c:\"documents and settings"\user.ccsdk12\desktop\status



Note that this script also uses a variable to hold the path to the logfile.




Now you can do one of two things:

You could complete this task using batch scripts. If you post a pointer to this question in the OS / DOS section then someone will help you:
  1. Identify failed pings in your output file
  2. Send an email using some DOS utility

A lot of people know a lot more than me about DOS which is why I suggest you post a pionter to this in there.



Alternatively you could try doing the whole thing using VBScript. It will take three times as much code but it will be in a more modern langauge and more 'interoperable'


If you want to try it in VBScript let me know, though I don't know if I have time to lay it all out for you.


0
 
LVL 4

Author Comment

by:Jandakel2
ID: 16965284
Thank you for the advice.  Knowing the >> operator will definitely prove useful for me.  I would love to see how you would do what I have said using a VB script.  I have been learning slowly but surely, and it would be an invaluable tool for me.  I am a network admin for a school district with 1600 users and at least 1000 computers.  There is only two of us that run the whole show, desktop tech all the way up, so you can imagine how busy we are, and how important automation is....Thank you very much for your reply, and if you do get some spare time, at your convenience I would whole heartedly appreciate how you would go about doing this in a VB Script.

Regards,

JK
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 16967054
If you are a network admin then VBScript is definitely going to help you.


I think MS is making it hard to find the VBScript documenation download as I can't seem to find it to get me (and you) started)


I can't help right now but why don't you leave this question open and see who else dives in.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 87
Access query that references subform 5 48
VBA Shell can't Find Word document 11 131
Fastest way to find and count same items VB6 16 47
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question