Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

System Status Script

Posted on 2006-06-21
3
Medium Priority
?
194 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 2000 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

Independent Software Vendors: 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

609 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