Re: Is It possible to run a script as admin?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: news.microsoft.com (Richard_at_RaptorCon.net)
Date: 04/14/04


Date: Wed, 14 Apr 2004 13:03:27 -0400

If the device is Win2K or WinXP, you can use RunAs, however Runas will only
work with an exe and you'll also have to specify a password (unencrypted).

The best way to do this is to use a program (Wise Installer is what I use)
to compile your code in an exe.
You'll still have the problem of passing the password, the way I have done
this in the past is to;
    Create an exe with your compiled code.
    Create another exe that calls RunAs+.exe (a microsoft scriptable runas
available on the net).
        Then you call runas+ to run the 1st exe in admin context passing it
the necessary parameters (& password).

SMS Installer could be used but be aware that it can be decompiled by
another SMSInstaller user and read the password.
I would also suggest:
  * Putting the password in split up string variables for more security
  * Try to place all the code necessay and date encode it so that if someone
was to get ahold of the exe (1st one complied in the 2nd one) then there
would not be any danger of them passing other arguments to run other code in
admin context.

If you were using WMI to connect to a remote box, then you could connect as
alterante credentials, however this is not possible when called from the PC
itself.

Richard

"cseeger" <cseeger@nospam.nospam> wrote in message
news:Xns94CB76449FCAEcseegerinteractivede@207.46.248.16...
> cseeger <cseeger@nospam.nospam> wrote in
> news:Xns94CB756302C5Bcseegerinteractivede@207.46.248.16:
>
> > Is it possible for me to run a script with administrator rights? From a
> > regular domain user account???
> >
> > thanks!!
> >
> > -cseeger
> >
>
> Sorry, I should elaborate. I wrote a script that requires the user have
> admin access. I dont want to grant that. Infact, the script is a logon
> script. If I could just allow admin access for the logon script I'd be
> set.
>
> So, is there a way to elevate the account status to admin, just to run
> the script. Then switch the account status back to normal user????
>
> thanks!
>
> -cseeger



Relevant Pages

  • Re: Is It possible to run a script as admin?
    ... > If the device is Win2K or WinXP, you can use RunAs, however Runas will ... > work with an exe and you'll also have to specify a password. ... I wrote a script that requires the user have ... If I could just allow admin access for the logon script I'd be ...
    (microsoft.public.scripting.vbscript)
  • Re: Is It possible to run a script as admin?
    ... > use) to compile your code in an exe. ... I wrote a script that requires the user ... If I could just allow admin access for the logon script ... I didnt even know runas existed in cmd line form! ...
    (microsoft.public.scripting.vbscript)
  • Re: convert VB script code to vb (cheap & dirty)
    ... an exe, there are other "cheap-and-dirty" ways to do it. ... of the compiler, the runtime, your script and a little ... the compiler, the runtime and your source code into temporary ... running your vbs with wscript). ...
    (microsoft.public.scripting.vbscript)
  • Re: exe file
    ... "Train my users"? ... An EXE, ... than a VBS script at doing just about anything. ... to convey the general difference between compiled code ...
    (microsoft.public.scripting.vbscript)
  • Re: Cross Site Scripting for .exe?
    ... How can an exe take in these ... > number and no other info...How do i find out if my script has been ... The error message thrown probably, depending on method, does ... webserver input file input file from the DB checked for other keyword ...
    (alt.computer.security)