Solved

Is user running as administrator in Vista?

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now