DiskDriveInfoProvider Constructor |
Namespace: Xcalibur.WMI.Hardware.Disk
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 // Disk Drive Info Provider 14 var provider = new DiskDriveInfoProvider(managementScope); 15 16 // Fetch data 17 provider.Refresh(); 18 19 // Print 20 foreach (var info in provider.Results) 21 { 22 Console.WriteLine($"{info.DeviceId}, " + 23 $"{info.Model}, " + 24 $"{info.Size}, " + 25 $"{info.StatusInfo}" ); 26 } 27 28 // Read 29 Console.Read(); 30} 31 32/* Results: 33 * 34 * \\.\PHYSICALDRIVE0, Samsung SSD 840 EVO 1TB, 1000202273280, Enabled 35 * 36 */