Solved

System Status Script

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…
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…

746 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

17 Experts available now in Live!

Get 1:1 Help Now