Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I know a process credentials given its name

Posted on 2011-03-01
3
Medium Priority
?
466 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 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