use ManagementObjectSearcher class with query strings

The following code sample shows ho to retrieve an enumeration of paused service using the ManagementObjectSearcher class pro grammatically. In  this code same, u create a new instance of ManagementObjectSearcher named MOS with the scope of root\CIMV2 and the query โ€œSelect * From Win32_Service Sate=โ€'Paused'โ€  that finds paused services. You then loop through the results of the query and display the paused services that are found

ManagementObjectSearcher MOS;
MOS = new ManagementObjectSearcher("\\root\\CIMV2""SELECT * FROM Win32_Service WHERE State='Paysed'");
foreach (ManagementObject mservice in MOS.Get())
{
    Console.WriteLine("Service Name:{0}- Service Caption ", mservice["Caption "], mservice["State"].ToString());
}