Solved

System Status Script

Posted on 2006-06-21
3
188 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now