"Juan" <> wrote...
> My vbs script it adds directories and settings to the machine this script
> sometimes uses shell dos command but it gets the error on access denied
> How can I give access to the vbs to run under administrator rights because
> it works if I run it under administrator?
Hi Juan,
If your script is performing actions which require Administrative consent,
there is no way to avoid this in Vista (short of disabling UAC, which is
*not* recommended).
But, you can make your scripts *request* consent, rather than just fail with
"access denied". In VBScript, the way to do this is to use the ShellExecute
method of Shell.Application, to run a "RUNAS" command. This provides a
wrapper for your original vbs script, so that it will run as the
administrator and request elevation to a full administrative token.
Basically, it's adding about 10 extra lines of code to your script.
For more background information, check out these pages:
http://www.winhelponline.com/articles/185/1/
http://www.microsoft.com/technet/tec...t/default.aspx
There are probably several other good links out there as well, which you can
find with Google etc.
Hope this helps, good luck with it!
--
Andrew McLaren
amclar (at) optusnet dot com dot au