scripts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day
I am running windows vista on a domain and I realised that my scripts are
not executing because of a error
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?
This script was working under windows xp perfectly in the past
 
Hi Juan,

If it's making changes to protected system files then it cannot run without
elevated privileges. This is a design change to prevent malicious software
from making system changes without the user's knowledge.

--
Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP

Windows help - www.rickrogers.org
My thoughts http://rick-mvp.blogspot.com
 
Juan said:
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/technetmag/issues/2007/06/UtilitySpotlight/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!
 
Back
Top