Solved

Monitoring a Windows 7 and Vista machine

Posted on 2012-03-21
3
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Suggested Courses

617 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