Hi,
Starts the program displays two processes, and emits This one error: "Access is denied".
Compiling errors do not

foreach (Process proc in allProcs)
            {
                Console.WriteLine("process: {0},  id: {1} Time: {2}", proc.ProcessName, proc.Id, proc.StartTime );
            }

Recommended Answers

All 2 Replies

Start time is a secured property, you can add your user to the Performance Log User Group to access most processes but i think there are still a few that are denied.
Do you need the start time for ALL processes or are you trying to get the info for a specific process?
You could put the call to process.StartTime inside a try..catch block; attempt to read start time, if exception occurs then set the outout to some default time (zero/now for instance). This way you will get all the data you can retrieve without crashing your app on the processes that are secured.

Thanks.

Time just does not show a systematic process? Are there any other criteria?
Maybe it is possible to show all processes of time off as Administrator (Logged in as normal user)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.