Avatar of MikhailGol
MikhailGol

asked on 

Forcing "User Account Control" dialog when a user runs the utility

Hi,
One of the utilities in my project does some software configuration and needs full access to "Program Files\..." folder. It also registers some COM-objects, etc. Thus, the utility needs the user to login as administrator. So, before proceeding the utility checks if the user is administrator.

Under Vista a user can right-click on the program icon and select "run as administrator". Doing so pops up a User Account Control window asking for administrator credentials. It is also possible to change a link settings to "run as administrator".

I want the "User Account Control" window to popup when a user starts my utility. How can I do that? Is the only way to do that - by changing link properties? I believe there should be some way to force Windows to run User Account Control window.

I would appreciate any input. .NET or Win API, anything.

Mikhail
.NET Programming

Avatar of undefined
Last Comment
Computer101
Avatar of MikhailGol
MikhailGol

ASKER

I found the solution myself. There is some discussion on a close topic here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=581315&SiteId=1

Mikhail

Basically, just add the following manifest (by using mt.exe utility) to the execuble file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
          <security>
               <requestedPrivileges>
                   <requestedExecutionLevel
                       level="RequireAdministrator"/>
               </requestedPrivileges>
          </security>
      </trustInfo>
  </assembly>
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo