5
Answers

system disks related in wpf ui c# backend

i want to do work with system disks,my application will do encyprtion ,decyprtion for that disks,my task is i want to list all disks and i want to separate who encypreted those to another list .how i will approach the logic how bring system drives to one list and how will i observe the status of them.and seprate them to another list.how should implement logic for them
 
Answers (5)
0
Nagendra Panyam

Nagendra Panyam

NA 190 18.8k 6y
go to solution explorer and rightClick on refrences and add refrence , then choose the system.management and click ok . then type using system.management;
now u can use this class in your app !
it works fine
0
Nagendra Panyam

Nagendra Panyam

NA 190 18.8k 6y
am using system.management name space but not unable to do
0
Nagendra Panyam

Nagendra Panyam

NA 190 18.8k 6y
ManagementObjectSearcher error coming what to do
 
0
Laxmidhar Sahoo

Laxmidhar Sahoo

NA 10.4k 55.3k 6y
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Management;   //This namespace is used to work with WMI classes. For using this namespace add reference of System.Management.dll .  
  6. using Microsoft.Win32;     //This namespace is used to work with Registry editor.  
  7. namespace OperatingSystemInfo1  
  8. {  
  9.     class TestProgram  
  10.     {  
  11.         static void Main(string[] args)  
  12.         {  
  13.             SystemInfo si = new SystemInfo();       //Create an object of SystemInfo class.  
  14.             si.getOperatingSystemInfo();            //Call get operating system info method which will display operating system information.  
  15.             si.getProcessorInfo();                  //Call get processor info method which will display processor info.  
  16.             Console.ReadLine();                     //Wait for user to accept input key.  
  17.         }  
  18.     }  
  19.     public class SystemInfo  
  20.     {  
  21.         public void getOperatingSystemInfo()  
  22.         {  
  23.             Console.WriteLine("Displaying operating system info....\n");  
  24.             //Create an object of ManagementObjectSearcher class and pass query as parameter.  
  25.             ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_OperatingSystem");  
  26.             foreach (ManagementObject managementObject in mos.Get())  
  27.             {  
  28.                 if (managementObject["Caption"] != null)  
  29.                 {  
  30.                     Console.WriteLine("Operating System Name : " + managementObject["Caption"].ToString());   //Display operating system caption  
  31.                 }  
  32.                 if (managementObject["OSArchitecture"] != null)  
  33.                 {  
  34.                     Console.WriteLine("Operating System Architecture : " + managementObject["OSArchitecture"].ToString());   //Display operating system architecture.  
  35.                 }  
  36.                 if (managementObject["CSDVersion"] != null)  
  37.                 {  
  38.                     Console.WriteLine("Operating System Service Pack   : " + managementObject["CSDVersion"].ToString());     //Display operating system version.  
  39.                 }  
  40.             }  
  41.         }  
  42.         public void getProcessorInfo()  
  43.         {  
  44.             Console.WriteLine("\n\nDisplaying Processor Name....");  
  45.             RegistryKey processor_name = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0", RegistryKeyPermissionCheck.ReadSubTree);   //This registry entry contains entry for processor info.  
  46.             if (processor_name != null)  
  47.             {  
  48.                 if (processor_name.GetValue("ProcessorNameString") != null)  
  49.                 {  
  50.                     Console.WriteLine(processor_name.GetValue("ProcessorNameString"));   //Display processor ingo.  
  51.                 }  
  52.             }  
  53.         }  
  54.     }  
  55.    

0
Laxmidhar Sahoo

Laxmidhar Sahoo

NA 10.4k 55.3k 6y
In Windows management query can get disc details and othe hardware componets .
Go through the link may help you
 
https://www.codeproject.com/Articles/54064/Working-With-Windows-Management-Instrumentation-WM