Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Is user running as administrator in Vista?

Posted on 2008-10-27
4
179 Views
Last Modified: 2010-04-21
How can I tell if the user id either running as administrator under Vista, or has UAC disabled?  (I have a reminder message that I display and if either of the above are true, then I don't want to display the message)
0
Comment
Question by:rmmarsh
  • 2
4 Comments
 

Accepted Solution

by:
jangins101 earned 250 total points
ID: 22818239
You can try just checking to see if the user is in the local administrator's group by getting the current WindowsPrincipal  and checking to see if it's in the Administrators role.
(http://www.danielmoth.com/Blog/labels/UAC.html)

// using System.Security.Principle;
private bool IsAdmin()
{
    WindowsIdentity id = WindowsIdentity.GetCurrent();
    WindowsPrincipal p = new WindowsPrincipal(id);
    
    return p.IsInRole("Administrators");
}

Open in new window

0
 

Author Comment

by:rmmarsh
ID: 22821332
What about UAC being disabled?  Is there a way to tell that?
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 22821455
0
 

Author Closing Comment

by:rmmarsh
ID: 31510568
Thank you both so much... I really appreciate it...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

809 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