Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Monitoring a Windows 7 and Vista machine

Posted on 2012-03-21
3
Medium Priority
?
381 Views
Last Modified: 2012-03-22
I have two workstations that are losing connectivity to the network. They seem to be losing the connection for a very small period of time; just long enough to lose mapped network drive and printer connections. I am looking for a way to monitor the two of them.
To see when this is occuring and for how long.

Any suggestions?
0
Comment
Question by:splitrockit
3 Comments
 
LVL 44

Expert Comment

by:Davis McCarn
ID: 37751914
There ought to be events in the system log on the systems; but, I would think that any utility which pinged those systems would prevent the problem.
0
 
LVL 38

Accepted Solution

by:
Rich Rumble earned 2000 total points
ID: 37752079
You can have a script that logs the issue, but you'll have to start it manually, or copy it to the startup folder as well.
Set objWMIServices= _
GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi") 
set objSink = WScript.CreateObject("WbemScripting.SWbemSink","SINK_")
set objSink2 = WScript.CreateObject("WbemScripting.SWbemSink","SINK2_")

objWMIServices.ExecNotificationQueryAsync objSink, _
  "Select * from MSNdis_StatusMediaConnect"
objWMIServices.ExecNotificationQueryAsync objSink2, _
 "Select * from MSNdis_StatusMediaDisconnect"

WScript.Echo "Listening to Media_connect Events..." & vbCrLf

While(1)
    WScript.Sleep 1000
Wend

Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
    WScript.Echo "Received media connect Event" & _
    vbCrLf & wmiObject.InstanceName, Now

End Sub

Sub SINK2_OnObjectReady(wmiObject, wmiAsyncContext)
    WScript.Echo "Received media disconnect Event" & _
    vbCrLf & wmiObject.InstanceName, Now
End Sub

Open in new window

http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/21/how-can-i-be-notified-any-time-a-network-cable-gets-unplugged.aspx
The script I created will let you know about each event, a disconnect and a connect. It won't tell you the cause but will log the time(s). Again it output's to the screen, if you want to have it store a log and you place it in the startup folder, make a batch file that calls the script like this:

@echo off
cscript /nologo disconnect.vbs >c:\temp\connection-log.txt

You will have to give the path to the disconnect.vbs script (above) as well.
-rich
0
 

Author Closing Comment

by:splitrockit
ID: 37753665
Thanks. Great script.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

885 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