(view source code of nicspeed.vbs as plain text)
On Error Resume Next
Select Case WScript.Arguments.UnNamed.Count
Case 0
Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
Set colItems = objWMIService.ExecQuery( "Select * from Win32_ComputerSystem", , wbemFlagReturnImmediately + wbemFlagForwardOnly )
For Each objItem in colItems
strComputer = objItem.Name
Next
Case 1
strComputer = WScript.Arguments.UnNamed(0)
Case Else
Syntax( )
End Select
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject( "winmgmts://" & strComputer & "/root/WMI" )
Set colItems = objWMIService.ExecQuery( "SELECT * FROM MSNdis_EthernetCurrentAddress WHERE Active = True", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly )
For Each objItem In colItems
strMsg = strMsg & "Ethernet Adapter : " & objItem.InstanceName & vbCrLf
Set col2Items = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed WHERE InstanceName = '" & objItem.InstanceName & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each obj2Item In col2Items
strMsg = strMsg & "NDIS Link Speed : " & obj2Item.NdisLinkSpeed & " kBps" & vbCrLf
Next
strMsg = strMsg & vbCrLf
Next
WScript.Echo strMsg
Sub Syntax( )
strMsg = strMsg & vbCrLf _
& "NICSpeed.vbs, Version 1.00" & vbCrLf _
& "Display network adapter link speed for " _
& "any WMI enabled computer on the network" & vbCrLf & vbCrLf _
& "Usage: CSCRIPT //NOLOGO NICSPEED.VBS " _
& "[ computer_name ]" & vbCrLf & vbCrLf _
& "Where: " & Chr(34) & "computer_name" & Chr(34) _
& " is the optional name of a remote computer" & vbCrLf _
& " (default is the local computer " _
& "name)" & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com" & vbCrLf & vbCrLf _
& "Created with Microsoft's Scriptomatic tool" & vbCrLf _
& "http://www.microsoft.com/technet/treeview/default.asp" _
& "?url=/technet/scriptcenter/WMImatic.asp" & vbCrLf
WScript.Echo strMsg
WScript.Quit(1)
End Sub
page last modified: 2024-04-16; loaded in 0.0048 seconds