Duncan Edwards
Duncan Edwards

Reputation: 1558

In Windows 7, "Run as Administrator" does not run as Administrator when UAC is turned off

When I run my c# Windows Forms Application on Windows 7 with:

This code:

WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);

still returns false. Is this expected behaviour?

Upvotes: 1

Views: 1556

Answers (1)

Jesse C. Slicer
Jesse C. Slicer

Reputation: 20157

I am pretty sure if the user is not an Administrator, Run As Administrator is not going to elevate that user's context for that application to that of Administrator. That would be a terrible security hole and end-run around enforced security of keeping users as normal users.

Upvotes: 2

Related Questions