Win32_PerfFormattedData_Tcpip_NetworkInterface unavailable

0

I am trying to use a VBScript to query bandwidth usage of my network card. But the query errors out.

    Set colItems = objWMIService.ExecQuery _ 
        ("select * from Win32_PerfFormattedData_TCPIP_NetworkInterface " ) 
    For Each objItem in colItems 
    WScript.Echo objItem.CurrentBandwidth
    NEXT 

I also tried this variation, and it doesn't work either.

    Set objInstances = objWMIService.InstancesOf("Win32_PerfFormattedData_Tcpip_NetworkInterface",48)

The following error is shown at the respective line numbers

    (null): 0x80041001

I am using windows 7. Ran the script as Admin. Checked that Admin has access to WMI as mentioned here. I am able to list all the network adapters using this code.

I tried using the powershell WMI browser and such a class name (Win32_PerfFormattedData_Tcpip_NetworkInterface) is not listed. Same when using the WMI Explorer from here. When i execute below query in the WMI Explorer, it says invalid query

    select Name from Win32_PerfFormattedData_Tcpip_NetworkInterface

I am able to find Win32_PerfFormattedData listed in both the explorers. No instances exist when choose this class in the KS-Soft WMI explorer. No classes exist that begin with the name Win32_PerfFormattedData_xxxxxxxx.

What am I missing here ?

windows
networking
wmi
asked on Stack Overflow Nov 26, 2014 by user3526 • edited Nov 26, 2014 by user3526

1 Answer

0

In the second example, you need two commas, for example :

Set colItems = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_Tcpip_NetworkInterface",,48)

answered on Stack Overflow Dec 16, 2014 by db-user

User contributions licensed under CC BY-SA 3.0