?
Solved

can you access process.TotalProcessorTime for a process on a remote computer!

Posted on 2006-05-24
4
Medium Priority
?
564 Views
Last Modified: 2008-01-09
Currently I get an exception when I attempt at access this property via a remote connection.

process.TotalProcessorTime cannot be access remotely!


Is there a way around this!
0
Comment
Question by:fwipho
1 Comment
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 16760796
You could try the Windows Management Instrumentation (WMI) equivalent

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_process.asp

Here is a script to demontrate the concepts

using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
    public class MyWMIQuery
    {
        public static void Main()
        {
            try
            {
                ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_Process");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("Win32_Process instance");
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("CommandLine: {0}", queryObj["CommandLine"]);
                    Console.WriteLine("KernelModeTime: {0}", queryObj["KernelModeTime"]);
                    Console.WriteLine("Name: {0}", queryObj["Name"]);
                    Console.WriteLine("UserModeTime: {0}", queryObj["UserModeTime"]);
                }
            }
            catch (ManagementException e)
            {
                MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
            }
        }
    }
}
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question