Hey,

We have an admin wrapper here that runs using local admin rights. It
uses the run as command to kick off a script with privileges but when
we put it into AD login scripts it runs ok but as soon as something
takes focus away from the command prompt window it stops the password
from being passed and it sits there prompting the user for a password.

Here is the script we are using is there anything we can do to get
around having to bring up the command prompt to pass the password or is
there a decent third party ap that could do it for us.

Any help would be appreciated.

Script:
Note user names and password changed for obvious reasons

Function RunUpdates
appl="runas /user:Adminuser " & """wscript update.vbs"""
WshShell.run appl,2,bwaitonreturn
Do Until WshShell.Appactivate("runas.exe")
wscript.sleep(200)
Loop
WshShell.sendkeys "password" & "{ENTER}"
End Function

Re: Attempting to Run a script with Admin privileges by Jason

Jason
Tue Jul 11 07:08:19 CDT 2006

Try AutoIT ( http://www.autoitscript.com/autoit3/ )
One of the key benefits especially for this type of script is the
RunAsSet option, which will not prompt for a password in an external
window. You can also compile AutoIt scripts into an .exe so the
username/password is not visible in plain text. The language is very
similar to VBScript although there are a few syntax differences. Best
of all, it's free.

- Jason

jano.contreras@gmail.com wrote:
> Hey,
>
> We have an admin wrapper here that runs using local admin rights. It
> uses the run as command to kick off a script with privileges but when
> we put it into AD login scripts it runs ok but as soon as something
> takes focus away from the command prompt window it stops the password
> from being passed and it sits there prompting the user for a password.
>
> Here is the script we are using is there anything we can do to get
> around having to bring up the command prompt to pass the password or is
> there a decent third party ap that could do it for us.
>
> Any help would be appreciated.
>
> Script:
> Note user names and password changed for obvious reasons
>
> Function RunUpdates
> appl="runas /user:Adminuser " & """wscript update.vbs"""
> WshShell.run appl,2,bwaitonreturn
> Do Until WshShell.Appactivate("runas.exe")
> wscript.sleep(200)
> Loop
> WshShell.sendkeys "password" & "{ENTER}"
> End Function


Re: Attempting to Run a script with Admin privileges by jano

jano
Tue Jul 11 18:16:08 CDT 2006

Jason,

I have got auto IT its just real confusing. I'll try and look into it
again but any other suggestions would be great.

Jason wrote:
> Try AutoIT ( http://www.autoitscript.com/autoit3/ )
> One of the key benefits especially for this type of script is the
> RunAsSet option, which will not prompt for a password in an external
> window. You can also compile AutoIt scripts into an .exe so the
> username/password is not visible in plain text. The language is very
> similar to VBScript although there are a few syntax differences. Best
> of all, it's free.
>
> - Jason
>
> jano.contreras@gmail.com wrote:
> > Hey,
> >
> > We have an admin wrapper here that runs using local admin rights. It
> > uses the run as command to kick off a script with privileges but when
> > we put it into AD login scripts it runs ok but as soon as something
> > takes focus away from the command prompt window it stops the password
> > from being passed and it sits there prompting the user for a password.
> >
> > Here is the script we are using is there anything we can do to get
> > around having to bring up the command prompt to pass the password or is
> > there a decent third party ap that could do it for us.
> >
> > Any help would be appreciated.
> >
> > Script:
> > Note user names and password changed for obvious reasons
> >
> > Function RunUpdates
> > appl="runas /user:Adminuser " & """wscript update.vbs"""
> > WshShell.run appl,2,bwaitonreturn
> > Do Until WshShell.Appactivate("runas.exe")
> > wscript.sleep(200)
> > Loop
> > WshShell.sendkeys "password" & "{ENTER}"
> > End Function


Re: Attempting to Run a script with Admin privileges by Jerold

Jerold
Wed Jul 12 09:43:49 CDT 2006

On 10 Jul 2006 20:27:18 -0700, "jano.contreras@gmail.com" <jano.contreras@gmail.com> wrote:

>Hey,
>
>We have an admin wrapper here that runs using local admin rights. It
>uses the run as command to kick off a script with privileges but when
>we put it into AD login scripts it runs ok but as soon as something
>takes focus away from the command prompt window it stops the password
>from being passed and it sits there prompting the user for a password.
>
>Here is the script we are using is there anything we can do to get
>around having to bring up the command prompt to pass the password or is
>there a decent third party ap that could do it for us.
>
>Any help would be appreciated.
>
>Script:
>Note user names and password changed for obvious reasons
>
>Function RunUpdates
> appl="runas /user:Adminuser " & """wscript update.vbs"""
>WshShell.run appl,2,bwaitonreturn
>Do Until WshShell.Appactivate("runas.exe")
> wscript.sleep(200)
>Loop
>WshShell.sendkeys "password" & "{ENTER}"
>End Function


See tip 9091 » LSRunAsE is a donationware RunAs utility with an encrypted password.
in the 'Tips & Tricks' at http://www.jsifaq.com

See tip 7258 » CPAU freeware is a RunAs replacement that lets you specify the password on the command-line.

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com

Re: Attempting to Run a script with Admin privileges by Jonamba

Jonamba
Fri Jul 14 23:00:46 CDT 2006

>
> We have an admin wrapper here that runs using local admin rights. It
> uses the run as command to kick off a script with privileges but when
> we put it into AD login scripts it runs ok but as soon as something
> takes focus away from the command prompt window it stops the
> password

Adminpassword in cleartext?
to run applications as another user you find a simple runas solution on
http://robotronic.de/runasspcEn.html (password are encrypt).