G
Guest
Using WMI, how do I retrieve the list of running applications on a pc? If
you open up task manager and click on the applications tab, I am trying to
retrieve the task name and the status. I looked high and low in the WMI
documentation and unable to find a class that returns this info.
Any help is appreciated.
#region List all properties from WMI Query
// WMI Documentation
//
http://msdn.microsoft.com/library/d...isdk/wmi/computer_system_hardware_classes.asp
string wmiQuery = "Select * from Win32_Process";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);
Console.WriteLine("================================================");
Console.WriteLine(wmiQuery);
Console.WriteLine("================================================");
foreach (ManagementObject service in searcher.Get())
{
Console.WriteLine("================================================");
Console.WriteLine("SERVICE: " + service.ToString());
Console.WriteLine("================================================");
foreach ( PropertyData s in service.Properties)
{
Console.WriteLine("Name: {0} Value: {1}", s.Name.ToString(),
service[s.Name.ToString()]);
}
Console.ReadLine();
}
Console.WriteLine("================================================");
Console.WriteLine("PRESS ENTER TO EXIT");
Console.WriteLine("================================================");
Console.ReadLine();
#endregion
you open up task manager and click on the applications tab, I am trying to
retrieve the task name and the status. I looked high and low in the WMI
documentation and unable to find a class that returns this info.
Any help is appreciated.
#region List all properties from WMI Query
// WMI Documentation
//
http://msdn.microsoft.com/library/d...isdk/wmi/computer_system_hardware_classes.asp
string wmiQuery = "Select * from Win32_Process";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);
Console.WriteLine("================================================");
Console.WriteLine(wmiQuery);
Console.WriteLine("================================================");
foreach (ManagementObject service in searcher.Get())
{
Console.WriteLine("================================================");
Console.WriteLine("SERVICE: " + service.ToString());
Console.WriteLine("================================================");
foreach ( PropertyData s in service.Properties)
{
Console.WriteLine("Name: {0} Value: {1}", s.Name.ToString(),
service[s.Name.ToString()]);
}
Console.ReadLine();
}
Console.WriteLine("================================================");
Console.WriteLine("PRESS ENTER TO EXIT");
Console.WriteLine("================================================");
Console.ReadLine();
#endregion