Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Monitoring a Windows 7 and Vista machine

Posted on 2012-03-21
3
Medium Priority
?
371 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

664 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