Solved

How can I know a process credentials given its name

Posted on 2011-03-01
3
460 Views
Last Modified: 2013-12-17
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
Comment
Question by:yossikally
3 Comments
 
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 35009653
0
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 35009677
0
 
LVL 1

Accepted Solution

by:
keenua earned 500 total points
ID: 35014989
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …

820 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