Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for nicspeed.kix

(view source code of nicspeed.kix as plain text)

  1. If $Help <> "" Or InStr( "$PC", "/" ) > 0 Or InStr( "$PC", "?" ) > 0
  2. 	$Ret = Syntax( )
  3. EndIf
  4.  
  5. If $PC = ""
  6. 	$PC = @WKSTA
  7. EndIf
  8.  
  9. $objWMIService = GetObject( "winmgmts://" + $PC + "/root/WMI" )
  10. If @ERROR
  11. 	$Ret = ShowError( )
  12. EndIf
  13. $colItems = $objWMIService.ExecQuery( "SELECT * FROM MSNdis_EthernetCurrentAddress WHERE Active = True", "WQL", 48 )
  14. For Each $objItem In $colItems
  15. 	$strMsg = $strMsg + "Ethernet Adapter : " + $objItem.InstanceName + @CRLF
  16. 	$col2Items = $objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed WHERE InstanceName = '" + $objItem.InstanceName + "'", "WQL", 48 )
  17. 	For Each $obj2Item In $col2Items
  18. 		$strMsg = $strMsg + "NDIS Link Speed  : " + $obj2Item.NdisLinkSpeed + " kBps@CRLF"
  19. 	Next
  20. 	$strMsg = $strMsg + @CRLF
  21. Next
  22. ? $strMsg
  23.  
  24.  
  25. Function ShowError( )
  26. 	? "Error # @ERROR"
  27. 	?
  28. 	$Ret = Syntax( )
  29. EndFunction
  30.  
  31.  
  32. Function Syntax( )
  33. 	$strMsg = $strMsg + "@CRLFNICSpeed.kix,  Version 1.00@CRLF"
  34. 	$strMsg = $strMsg + "Display network adapter link speed for any WMI enabled computer on the network@CRLF@CRLF"
  35. 	$strMsg = $strMsg + "Usage:  KIX32  NICSPEED.KIX  [ $$PC=computer_name ]@CRLF@CRLF"
  36. 	$strMsg = $strMsg + "Where:  " + Chr(34) + "computer_name" + Chr(34) + " is the optional name of a remote computer@CRLF"
  37. 	$strMsg = $strMsg + "                        (default is the local computer name)@CRLF@CRLF"
  38. 	$strMsg = $strMsg + "Written by Rob van der Woude@CRLF"
  39. 	$strMsg = $strMsg + "http://www.robvanderwoude.com@CRLF@CRLF"
  40. 	$strMsg = $strMsg + "Created with Microsoft's Scriptomatic tool@CRLF"
  41. 	$strMsg = $strMsg + "http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/WMImatic.asp@CRLF"
  42. 	? $strMsg
  43. 	Quit(1)
  44. EndFunction
  45.  

page last modified: 2024-04-16; loaded in 0.0053 seconds