new ManagementObjectSearcher : ManagementObjectSearcher « System.Management « C# / C Sharp by API






new ManagementObjectSearcher

  
using System;
using System.Management;
public class MainClass {
    public static void Main() {
        string query = "SELECT * FROM Win32_PrintJob";
        using (ManagementObjectSearcher jobQuery = new ManagementObjectSearcher(query)) {
            using (ManagementObjectCollection jobs = jobQuery.Get()) {
                foreach (ManagementObject job in jobs) {
                    Console.WriteLine(job["JobID"]);
                }
            }
        }
    }
}

   
    
  








Related examples in the same category