Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 610267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:39:22+00:00 2026-05-13T17:39:22+00:00

Background: I am by no means a windows security / user permissions expert. I

  • 0

Background: I am by no means a windows security / user permissions expert. I have an application (written in C#), that has to be able to write / delete files & folders in its root directory, write / delete files elsewhere on the disk, write/modify values in System Registry (Local Machine) and start & stop other applications and services. I figure that I need administrator privileges for at least some of those actions.

I tried running this and on computers with UAC turned off it works great without any additional settings. However on computers with UAC turned on (any level above ‘never notify’ in Windows 7) it will crash. I need it to work on all computers.

Up to now I would just manually check the “run this program as administrator” checkbox and everything would be fine. However now we have decided that we will allow customers to install this software on their own, and it needs to run “out of the box”.

I have a deployment project in Visual Studio 2008 that installs everything and writes the necessary start up data in registry. What I need to do now is to set the “Run this program as Administrator” flag. I am guessing this isn’t quite as simple as I’d like it to be.

So What is the proper way of doing this? This program is started on startup, and it would be irritating for our customers if UAC would pop up (and possibly dim the screen) every time they restart their computer.

Thank you for your help.

EDIT: Thank you for your replies. I realise that working around UAC would be frowned upon, and I can see that Microsoft does not support “white lists” so it would ask for permission only once. That’s fine I can respect that, however I do have some follow up questions:

  • Can you provide me with a link that will show me how to properly elevate the program to correct elevated state? Is there any literature on what are the options, etc… Basicly I’d love a UAC 101 guide.

  • Is there a way to elevate the security status when I need the extra privileges (and only then prompt with UAC). Basicly this applications runs in the background, doing mostly nothing for most of the time. Every now and again it will check some files (at this point I will require to be able to write to disk and read the registry (read only is fine at this point), however since it’s a temporary folder it wouldn’t matter where I’d put it. If there is a location where the application can write without any privileges that would be perfect.)

    However at some point I will need to preform all the rest of the tasks (user needs to confirm this action anyway) so if UAC would prompt at this point that would be no problem. Is there a way to elevate it just at this point, and then return it to default permissions?

  • Will such a solution work with older versions of Windows, including Vista and Xp (and perhaps older?) What would it take to make it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:39:23+00:00Added an answer on May 13, 2026 at 5:39 pm

    The proper way is to elevate when the program starts, with the UAC prompt (which you can set via the program’s manifest) – attempting to be clever and bypass it is frowned upon.

    Think about it – if you could install something which would elevate automatically without the UAC prompt … what would be the point of UAC?

    To add a UAC manifest to a program you simply add the manifest in a project and edit it. A sample manifest for UAC is here. If you want to elevate at the last possible moment then you need a spawn separate process – you cannot elevate an existing process. So separate that bit out and then start it using

    Process.StartInfo.UseShellExecute = true;
    Process.StartInfo.Verb = "runas";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this application (Windows form application written in Visual C++) from a colleague
My application has a custom window design, which means that every window has the
Background : I have a small Python application that makes life for developers releasing
I have web page that has a collection of tiled elements as a background.
I am building a Cocoa Mac application that runs in the background but has
We have an application generated using the Sculpture software package . That means the
Background: We're building an application that allows our customers to supply data in a
Background: I would like to dismiss a modalView that I have presented earlier and
I have a windows service that fails to start under some circumstances. When it
In a Windows Phone project I have the following scenario: The user types some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.