Solved

Is user running as administrator in Vista?

Posted on 2008-10-27
4
178 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

785 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