I want to use the "Run As Administrator" functionality of Windows Vista
(UAC), from a vbScript to call any application.
It is possible?
Thanks.
I want to use the "Run As Administrator" functionality of Windows Vista
(UAC), from a vbScript to call any application.
It is possible?
Thanks.
Yes. Here is a sample script!
- - -
Set objSh = CreateObject("Shell.Application")
objSh.ShellExecute "notepad.exe", "" , "", "runas", 1
- - -
It is possible to pass through the same function User and Password of
Administrator to execute this application?
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.
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.
I have to do same work for WIN-XP also along with win-7 and vista.
How can I run single script for these OS, or I will have to write different for XP and for vista & 7, if yes then how in xp?
I am not sure about all the ways that might you help in this. For that run command prompt and then in that use the Runas command. The normal way of a command looks like RunAs /user:YourDomain\Administrator CScript YourVbsFiel.vbs. Once you execute the command it will as for a password to run the vbs script as Administrator.
Bookmarks