Solved

Monitoring a Windows 7 and Vista machine

Posted on 2012-03-21
3
355 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 42

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 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

707 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