Run As Administrator from vbScript

S

Santiago Bruni

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

Thanks.
 
R

Ramesh, MS-MVP

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/articles/185/1/VBScripts-and-UAC-elevation.html

--
Regards,

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

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

Thanks.
 
S

Santiago Bruni

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

Regards.
 
R

Ramesh, MS-MVP

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

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

Regards.
 
D

DevilsPGD

In message <[email protected]> Santiago
Bruni said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top