# How to make VBscript "Run As Administrator" automatically.



## pure_evil020 (Jul 31, 2008)

Hi there,
I have a program that executes a vbscript to perform certain tasks, but it does not work properly without being "Run As Administrator" on a windows 7 OS.
Its fine with windows XP OS, but windows 7 insists on being run as administrator, otherwise it denies access to the TEMP folder, when the program attempts to write and execute a script.

My solution (if such a script is possible) would be to make another pre-packed VBscript, or Reg file, included with the program executable, then have the program recognize when the user launches the program for the first time, check if the user is running windows 7, then if this returns true, pop up a message to tell the user that windows 7 requires the program to be "Run As Administrator", and ask the user if they would like the program to automatically "Run As Administrator" in the future.

If the user agrees, the program would run this pre-packed VBscript (Or Reg file) to make the exe always run as administrator (If this is possible)...


I'm hoping there is some kind of registry entry that can be modified, to allow an EXE to always be launched with administrative privileges.



If you're asking "Why don't you just pre-pack all of the scripts then?", this is because the scripts are "User Defined", meaning the user defines certain parameters for the script, then the program writes the script, based on what the user wanted done, and launches that script.
Therefore, even if I Pre-packed the scripts, the program would still need to access and edit the script files, to make the script do whatever the user wants (which windows 7 will not allow without the program being run as administrator).


So is there such a script (VB, or Reg) that could permanently give a program exe Administrative privileges?


----------

