Windows Vista Forums

Run As Administrator from vbScript

  1. #1


    Santiago Bruni Guest

    Run As Administrator from vbScript

    I want to use the "Run As Administrator" functionality of Windows Vista
    (UAC), from a vbScript to call any application.
    It is possible?

    Thanks.

      My System SpecsSystem Spec

  2. #2


    Ramesh, MS-MVP Guest

    Re: Run As Administrator from vbScript

    Yes. Here is a sample script!

    - - -
    Set objSh = CreateObject("Shell.Application")
    objSh.ShellExecute "notepad.exe", "" , "", "runas", 1
    - - -

    See also:

    VBScripts and UAC elevation:
    http://www.winhelponline.com/article...elevation.html

    --
    Regards,

    Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
    The Winhelponline Blog: http://www.winhelponline.com/blog
    Windows® Troubleshooting: http://www.winhelponline.com

    "Santiago Bruni" <SantiagoBruni@xxxxxx> wrote in message news:354D2163-7D84-484E-BE54-81B9319B9094@xxxxxx
    I want to use the "Run As Administrator" functionality of Windows Vista
    (UAC), from a vbScript to call any application.
    It is possible?

    Thanks.

      My System SpecsSystem Spec

  3. #3


    Santiago Bruni Guest

    Re: Run As Administrator from vbScript

    Thanks Ramesh!!!
    It is possible to pass through the same function User and Password of
    Administrator to execute this application?

    Regards.

    "Ramesh, MS-MVP" wrote:

    > Yes. Here is a sample script!
    >
    > - - -
    > Set objSh = CreateObject("Shell.Application")
    > objSh.ShellExecute "notepad.exe", "" , "", "runas", 1
    > - - -
    >
    > See also:
    >
    > VBScripts and UAC elevation:
    > http://www.winhelponline.com/article...elevation.html
    >
    > --
    > Regards,
    >
    > Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
    > The Winhelponline Blog: http://www.winhelponline.com/blog
    > Windows® Troubleshooting: http://www.winhelponline.com
    >
    > "Santiago Bruni" <SantiagoBruni@xxxxxx> wrote in message news:354D2163-7D84-484E-BE54-81B9319B9094@xxxxxx
    > I want to use the "Run As Administrator" functionality of Windows Vista
    > (UAC), from a vbScript to call any application.
    > It is possible?
    >
    > Thanks.
    >

      My System SpecsSystem Spec

  4. #4


    Ramesh, MS-MVP Guest

    Re: Run As Administrator from vbScript

    Nope. I don't think it's possible, especially in the UAC dialog. Perhaps you can repost this question in WSH groups for any alternate solutions.

    --
    Regards,

    Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
    The Winhelponline Blog: http://www.winhelponline.com/blog
    Windows® Troubleshooting: http://www.winhelponline.com

    "Santiago Bruni" <SantiagoBruni@xxxxxx> wrote in message news:046E6BD3-9327-46F0-ACA1-6CB71F4F9AE7@xxxxxx
    Thanks Ramesh!!!
    It is possible to pass through the same function User and Password of
    Administrator to execute this application?

    Regards.

    "Ramesh, MS-MVP" wrote:

    > Yes. Here is a sample script!
    >
    > - - -
    > Set objSh = CreateObject("Shell.Application")
    > objSh.ShellExecute "notepad.exe", "" , "", "runas", 1
    > - - -
    >
    > See also:
    >
    > VBScripts and UAC elevation:
    > http://www.winhelponline.com/article...elevation.html
    >
    > --
    > Regards,
    >
    > Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
    > The Winhelponline Blog: http://www.winhelponline.com/blog
    > Windows® Troubleshooting: http://www.winhelponline.com
    >
    > "Santiago Bruni" <SantiagoBruni@xxxxxx> wrote in message news:354D2163-7D84-484E-BE54-81B9319B9094@xxxxxx
    > I want to use the "Run As Administrator" functionality of Windows Vista
    > (UAC), from a vbScript to call any application.
    > It is possible?
    >
    > Thanks.
    >

      My System SpecsSystem Spec

  5. #5


    DevilsPGD Guest

    Re: Run As Administrator from vbScript

    In message <046E6BD3-9327-46F0-ACA1-6CB71F4F9AE7@xxxxxx> Santiago
    Bruni <SantiagoBruni@xxxxxx> wrote:

    >It is possible to pass through the same function User and Password of
    >Administrator to execute this application?
    Are you trying to bypass the UAC prompt, or run an application with
    administrative privileges after a UAC prompt?

    If you can handle waiting a minute or two, you can have a scheduled task
    that launches a script to look for an external trigger (existence of a
    temporary file would be the easiest) that kicks off the elevated
    process.

    If you wanted something more real-time and don't need to interact with
    the desktop, you could write a service to accomplish your goal.

      My System SpecsSystem Spec

Run As Administrator from vbScript

Similar Threads
Thread Forum
VbScript and Windows 7 x64 - in IEx64 vbscript works, but not in I
We have a windows 7 x64 machine - a fresh install. We created a <script language="vbscript"> tag inside a web page, with a simple window.alert...
VB Script
are VBscript on Windows server 2003 and VBscript on WS2008 compatible?
Hi everybody, Sorry if my question has already been asked, but I haven't found anything which is clear for me on this point. I spent a lot of...
VB Script
Can a vbscript identify the program/process that called a vbscript
I would like to code a vbscript ("ActionScript.vbs") in such a way that it would do X, if ActionScript.vbs were called by "TriggerScriptA.vbs", but...
VB Script
How to do No hang up VBScript (nohup for VBScript)
I'm running XP SP-2. How can I execute a VBScript so that when I log out the script continues to execute. More specifically... I'd like to...
VB Script
Account 'NAMED' Administrator vs. 'administrator rights' question
many amatuer radio programs do not work well if installed into Vista's Programs directory. Hence we have learned to not install that way but to...
Vista installation & setup
If I am logged in as administrator why don't programs run as administrator vista?
If I am logged in as administrator why don't programs run as administrator? I am editing files on my C: drive - html stationary used in Outlook,...
Vista General
Cannot Perform Administrator Tasks but I'm an Administrator
I am running Windows Home Basic. It is no longer allowing me to perform administrator tasks like installing and uninstalling programs. This is a...
Vista General