Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to programmatically set Admin privilege for exe (Vista)

How to programmatically set Admin privilege for exe (Vista)

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sp_ranjan
    wrote on last edited by
    #1

    Hi, I want to make my application compitible for Windows Vista.How do i programmatically enable the property "Run this program as an administrator" in Windows Vista?

    C 1 Reply Last reply
    0
    • S sp_ranjan

      Hi, I want to make my application compitible for Windows Vista.How do i programmatically enable the property "Run this program as an administrator" in Windows Vista?

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Isn't that a choice that the user has to make? If you were able to override the user's level of privilege just imagine what sort of trouble viruses and trojens could create!


      Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      S 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Isn't that a choice that the user has to make? If you were able to override the user's level of privilege just imagine what sort of trouble viruses and trojens could create!


        Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

        S Offline
        S Offline
        sp_ranjan
        wrote on last edited by
        #3

        Thank you, Colin Angus Mackay for the quick response.I want to set admin privileges only to the exes of my application. How can this have adverse effect!

        D C 2 Replies Last reply
        0
        • S sp_ranjan

          Thank you, Colin Angus Mackay for the quick response.I want to set admin privileges only to the exes of my application. How can this have adverse effect!

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Becuase if any .EXE could just raise it's own privileges, any virus could do that same and do catastrophic damage to the O/S!! What you want to do cannot be done because you cannot raise your privileges to anything abouve what the user already has. The user has to turn this option on outside of your code.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          S 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Becuase if any .EXE could just raise it's own privileges, any virus could do that same and do catastrophic damage to the O/S!! What you want to do cannot be done because you cannot raise your privileges to anything abouve what the user already has. The user has to turn this option on outside of your code.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            S Offline
            S Offline
            sp_ranjan
            wrote on last edited by
            #5

            If it is possible, i will be making the admin privilege settings at the time of installation after getting the user's permission.Will that have any security breach.

            D 1 Reply Last reply
            0
            • S sp_ranjan

              If it is possible, i will be making the admin privilege settings at the time of installation after getting the user's permission.Will that have any security breach.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Again, you can't do it from your code, even in the installation. A user cannot grant permissions above his own account.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              1 Reply Last reply
              0
              • S sp_ranjan

                Thank you, Colin Angus Mackay for the quick response.I want to set admin privileges only to the exes of my application. How can this have adverse effect!

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                sp_ranjan wrote:

                I want to set admin privileges only to the exes of my application

                Then it must be run as Admin

                sp_ranjan wrote:

                How can this have adverse effect!

                Because it could take over the user's machine without the user realising. If you need your application to run as admin you have to ask permission from the user. The user then has to make a judgement whether to trust your code.


                Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups