コード例 #1
0
ファイル: WMI.cs プロジェクト: gam4er/BulkReq
 static CimAsyncMultipleResults <CimInstance> AsyncListRunningProcesses(CimSession session)
 {
     if (!HideToConsole)
     {
         Console.WriteLine("{0,-10} {1,-10} {2,4:1}", "PID", "PPID", "Name");
     }
     return(session.QueryInstancesAsync(@"root\cimv2", "WQL", "SELECT * FROM Win32_Process"));
 }
コード例 #2
0
 public static void QueryInstanceASync(CimSession cimSession, string cimNamespace)
 {
     try
     {
         string query = QueryInstanceCore();
         IObservable <CimInstance>  queryInstances = cimSession.QueryInstancesAsync(cimNamespace, "WQL", query, GetOperationOptions());
         TestObserver <CimInstance> observer       = new TestObserver <CimInstance>();
         IDisposable disposeable = queryInstances.Subscribe(observer);
         observer.WaitForCompletion();
     }
     catch (CimException ex)
     {
         PrintCimException(ex);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }