Skip to content


Enumerating network adapters (WMI: Win32_NetworkAdapter, VBScript)

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("localhost")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems
      WScript.Echo "AdapterType: " & objItem.AdapterType
      WScript.Echo "AdapterTypeId: " & objItem.AdapterTypeId
      WScript.Echo "AutoSense: " & objItem.AutoSense
      WScript.Echo "Availability: " & objItem.Availability
      WScript.Echo "Caption: " & objItem.Caption
      WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
      WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
      WScript.Echo "CreationClassName: " & objItem.CreationClassName
      WScript.Echo "Description: " & objItem.Description
      WScript.Echo "DeviceID: " & objItem.DeviceID
      WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
      WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
      WScript.Echo "Index: " & objItem.Index
      WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
      WScript.Echo "Installed: " & objItem.Installed
      WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
      WScript.Echo "MACAddress: " & objItem.MACAddress
      WScript.Echo "Manufacturer: " & objItem.Manufacturer
      WScript.Echo "MaxNumberControlled: " & objItem.MaxNumberControlled
      WScript.Echo "MaxSpeed: " & objItem.MaxSpeed
      WScript.Echo "Name: " & objItem.Name
      WScript.Echo "NetConnectionID: " & objItem.NetConnectionID
      WScript.Echo "NetConnectionStatus: " & objItem.NetConnectionStatus
      strNetworkAddresses = Join(objItem.NetworkAddresses, ",")
         WScript.Echo "NetworkAddresses: " & strNetworkAddresses
      WScript.Echo "PermanentAddress: " & objItem.PermanentAddress
      WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
      strPowerManagementCapabilities = Join(objItem.PowerManagementCapabilities, ",")
         WScript.Echo "PowerManagementCapabilities: " & strPowerManagementCapabilities
      WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
      WScript.Echo "ProductName: " & objItem.ProductName
      WScript.Echo "ServiceName: " & objItem.ServiceName
      WScript.Echo "Speed: " & objItem.Speed
      WScript.Echo "Status: " & objItem.Status
      WScript.Echo "StatusInfo: " & objItem.StatusInfo
      WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
      WScript.Echo "SystemName: " & objItem.SystemName
      WScript.Echo "TimeOfLastReset: " & WMIDateStringToDate(objItem.TimeOfLastReset)
      WScript.Echo
   Next
Next

Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
    WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
    Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
    & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function

Related posts:

  1. Enumerating network adapters (WMI: Win32_NetworkAdapter, JScript)
  2. WMI Disk Drive Information (WMI: Win32_DiskDrive, VBScript)
  3. List Processes (WMI: Win32_Process, VBScript)
  4. Retrieving System Information (WMI: Win32_OperatingSystem, VBScript)
  5. WMI Disk Drive Information (WMI: Win32_DiskDrive, JScript)

Posted in Scripts, VBScript.



SEO Powered by Platinum SEO from Techblissonline