Solved

System Status Script

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS expression Issue finding a string 10 89
How does CurrentUser work? 10 38
Crystal reports - Formula Field code need assistance with code 17 81
Visual Studio 2005 text editor 10 43
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

791 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