NetworkAdapterInfoProvider Constructor |
Namespace: Xcalibur.WMI.Hardware.Network
public NetworkAdapterInfoProvider( ManagementScope ms, double version = 6.1, int id = -1 )
1// Main 2private static void Main() 3{ 4 // Make a connection to the local machine 5 const string computer = "."; 6 var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions 7 { 8 Impersonation = ImpersonationLevel.Impersonate, 9 Authentication = AuthenticationLevel.Connect 10 }); 11 managementScope.Connect(); 12 13 // Network Adapter Info Provider 14 var provider = new NetworkAdapterInfoProvider(managementScope); 15 16 // Fetch data 17 provider.Refresh(); 18 19 // Print 20 foreach (var info in provider.Results) 21 { 22 Console.WriteLine($"{info.Name}"); 23 Console.WriteLine($"{info.MacAddress}"); 24 Console.WriteLine($"{info.Speed}"); 25 Console.WriteLine($"{info.Availability}"); 26 Console.WriteLine(""); 27 } 28 29 // Read 30 Console.Read(); 31} 32 33/* Results: 34 * 35 * Intel(R) Ethernet Connection (2) I219-V 36 * 14:DD:A9:EE:B0:1D 37 * 1000000000 38 * Running 39 * 40 */