Solved

Monitoring a Windows 7 and Vista machine

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
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…

740 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