• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

How can I know a process credentials given its name

I need to know if a process is currently being run with administrator's privileges.
Can I know that given the process' name that I get by enumerating all running processes?
0
yossikally
Asked:
yossikally
1 Solution
 
Kalpesh ChhatralaSoftware ConsultantCommented:
0
 
rawinnlnx9Commented:
0
 
keenuaCommented:
you'll need to add "using System.Diagnostics" at the beginning

By the user name you can define whether current process is running with administrator privileges.
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
  Console.WriteLine("Process: " + p.ProcessName);
  Console.WriteLine("User Name: " + p.StartInfo.UserName);
  Console.WriteLine();
}

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now