How to execute a exe with Admin account from a console application ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gilles LAMBERT

    How to execute a exe with Admin account from a console application ?

    Hi,

    I need to automize installation of exe and files on different versions
    of Windows (except 95) from a console application. It includes shortcut
    creation for all users wich requires more privileges then those of the
    current user. So, does any body know if it's possible to run a exe with
    more privilege than those of the connected user form a console
    application ?

    Thanks and best regards
    Gilles


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • MSFT

    #2
    RE: How to execute a exe with Admin account from a console application ?

    Hi Gilles,

    I have to say that you may not be able to achieve this without enough
    privileges. Without Administrator's permission, you can't create short cut
    for other people with a normal account.

    Anyway, if you already know a local administrator's account and passqord,
    you may execute the problem from "RunAs" command (only one Windows 2000, XP
    and 2003), for more information on this, you can type "runas /?" in DOS
    command line window, or refer to this article:

    HOW TO: Enable and Use the "Run As" Command When Running Programs in Windows


    Hope this answer your question,

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)




    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: How to execute a exe with Admin account from a console application ?

      Hello,

      "Gilles LAMBERT" <webmaster@tuto rials-online.com> schrieb:[color=blue]
      > I need to automize installation of exe and files on different
      > versions of Windows (except 95)[/color]

      Huh... .NET applications won't run on Windows 95.
      [color=blue]
      > from a console application. It includes shortcut
      > creation for all users wich requires more privileges then
      > those of the current user. So, does any body know if it's
      > possible to run a exe with more privilege than those
      > of the connected user form a console application ?[/color]

      You may use the 'ImpersonateLog gedOnUser' Win32-API function through
      PInvoke:

      VB6 sample (to be translated to VB.NET):

      Die Domain gssg.de steht zum Verkauf. Kontaktieren Sie den Inhaber über das Kontaktformular und senden Sie ein unverbindliches Angebot.


      --
      Herfried K. Wagner
      MVP ยท VB Classic, VB.NET
      Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



      Comment

      Working...