==========================================================
Dim locator = CreateObject("WbemScripting.SWbemLocator")
Dim Cim = locator.ConnectServer("", "root/cimv2")
Dim wmi = locator.ConnectServer("", "root/wmi")
Dim WQL = "Select * From Win32_NetworkAdapterConfiguration
Where DatabasePath IS NOT NULL"
Dim NetworkAdapters = Cim.ExecQuery(WQL)
Dim Adapter As Object
For Each Adapter In NetworkAdapters
Dim cap = Adapter.Caption
Dim prop = "MSNdis_LinkSpeed='" & Mid(cap, InStr(cap, "]")
+ 2) & "'"
Dim LinkInfo = wmi.Get(prop)
MsgBox(LinkInfo.NdisLinkSpeed)
Next
// Sample for LinkSpeed Retrieval
// Specify the namespace that you will like to obtain NdisLinkSpeed
ManagementScope scope = new ManagementScope("\\\\.\\root\\wmi");
// Note: The default namespace in ManagementScope is root\cimv2
SelectQuery query = new SelectQuery("Select * From
Win32_NetworkAdapterConfiguration Where DatabasePath IS NOT NULL");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject o in searcher.Get()) {
// You will need to find or write your own Mid() function for your string
operations.
String Network_InstanceName = o["Caption"].ToString().Substring(11);
Console.WriteLine(Network_InstanceName);
SelectQuery queryClass = new SelectQuery("Select * from MSNdis_LinkSpeed
where InstanceName = '" + Network_InstanceName + "'");
ManagementObjectSearcher s = new ManagementObjectSearcher(queryClass);
// Set namespace as defined above
s.Scope = scope;
ManagementPath Path = new
ManagementPath(string.Format("MSNdis_LinkSpeed.InstanceName='{0}'",
Network_InstanceName));
ManagementObject obj = new ManagementObject(scope,Path,null);
// Display results to console
Console.WriteLine("Name of the Instance: {0}", obj["InstanceName"]);
Console.WriteLine("LinkSpeed is : {0}", obj["NdisLinkSpeed"]);
}
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"jianpingjimpaul" <jr...@novus-tele.net> wrote in message
news:ed9147b8.02122...@posting.google.com...