I've been trying to run a VBScript file every time my system starts up, and have tried modifying the registry using VBScript to add it to the list of programs to run, but I'm facing a problem with permissions even though I'm the computers administrator. I'm trying to add
VB_Start.vbs
to the list of startup tasks by modifying the registry with the following VBScript code:When I execute this code I'm getting the following error:
Darth Android34.4k44 gold badges7878 silver badges100100 bronze badges
Feb 10, 2011 Alternatively, create a shortcut in startup and mark it as 'run as administrator.' Click 'yes' when you log on. Note that the GPO will simply change it again after the next refresh, though, so the recommended way is to change the GPO.
user226438user226438
2 Answers
80070005 indicates an access denied error. Just because you're an admin doesn't mean your VBS is being executed automatically with admin rights. Add the following code to the top of the script:
The code will detect if the script is running elevated, else relaunch itself with admin rights (you'll still see the prompt of course).
KaranKaran49.9k1414 gold badges9494 silver badges167167 bronze badges
This is the format of code I use for adding registry keys. All you'd have to change is what's in
Darth AndroidstrValueName
, the strStringValues
, and the initial CONST
to point to the proper section in the registry. Those codes are:34.4k44 gold badges7878 silver badges100100 bronze badges
KruugKruug4,97222 gold badges1818 silver badges2828 bronze badges