padma

padma

  • NA
  • 11
  • 11.8k

How to get the process description based on process ID(c#)?

Jul 10 2014 3:06 AM
Hi all,
I have tried in two ways
Solution1:-
code:- Process proc = Process.GetProcessById(pid);
string process_description= proc.MainModule.FileVersionInfo.FileDescription
Problem:-when we trying to access the MainModule property for some processes 0(idle), 4(system) or services(Having admin acces rights)
(most likely those running under SYSTEM credentials) on which user don't have the permission leads to win32 ACCESS DENIED EXCEPTION.
Solution 2:-
code :- string process_description=FileVersionInfo.GetVersionInfo(modulePath).FileDescription;
Problem :-Unable to get process decription if it was not mention in the properties of exe file or process which have admin rights .
For example:if process is google chrome.
ImageName:-chrome.exe         Description :Google chrome 
I want to get the description not the Image Name. 
Can any one share your ideas how to get process description in taskmanager for particular process id.

Answers (4)