Sign in to follow this  
Followers 0
DCSS

Help with RUNAS

8 posts in this topic

First off, I am a newbie. I discovered AutoIt last week and have already written some very useful scripts using the Help and these Forums. Great resources.

However, I am stumped. I need to install Reflection 2008 on about 200 workstations from a Novell server. It can be done through the login script but the setup requires admin rights which the users do not have. I have been trying to use RUNAS but have had little luck. I've tried various suggestions I found in this forum but no luck. One problem I have is that each time I run the AutoIt script, I immediately get a message box with Rc:0 @error:1. I do not know what this means nor how to figure out what is going on.

Here is the script using RunAsWait and any advise would really help and be very much appreciated.

; Fill in the username and password appropriate for your system.
Local $sUserName = "usr"
Local $sPassword = "pwd"

MsgBox(0, "Normal", "Username:" & @UserName & "   " & $sUserName)

$rc = RunAsWait($sUserName, "WORKGROUP", $sPassword, 0, "\\Dcss-fs01\APPS\Winapps\Reflect2008Install\setup.exe", "\\Dcss-fs01\APPS\Winapps\Reflect2008Install\")
MsgBox(0, "Rc", "Rc:" & $rc & @LF & "@error:" & @error)

sleep(3000)
; Show a message.
MsgBox(0, "", "The process we were waiting for has closed.")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First: The working directory is not the same thing as the program directory, and I don't think it can be a network path.

Second: It is a really bad idea to embed a password in your script, it can be extracted.

Third: Check out PSExec as the most common way to do this. If the Task Scheduler service is running, you could just remotely schedule it to run under that user with SchTasks.exe.

:D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

First: The working directory is not the same thing as the program directory, and I don't think it can be a network path.

Second: It is a really bad idea to embed a password in your script, it can be extracted.

Third: Check out PSExec as the most common way to do this. If the Task Scheduler service is running, you could just remotely schedule it to run under that user with SchTasks.exe.

:huggles:

Thanx for the prompt reply.

I was not sure how the working directory is used and had tried different entries including @SystemDir with the same results. I understand what you say about the password but the examples I used had it this way. If there is a better more secure way, I am open to hear it. Finally, I am looking into using PSExec and Runas on the command line but have had no luck yet. AutoIt capabilities and functions seemed to offer a better solution.

Thanx again and if there is any other recommendation you or other forum members can offer, I would very much apprciate it. :D

Share this post


Link to post
Share on other sites

Well, PSExec is a command line operation, and the most common solution around here is to write an AutoIt script that gets info from the Administrator, and then runs PSExec against the selected machines to perform the function. That script can simply prompt the Administrator for the password with InputBox() and then work it into the PSExec commandlines at run time. The password is not hard coded into the script that way.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Well, PSExec is a command line operation, and the most common solution around here is to write an AutoIt script that gets info from the Administrator, and then runs PSExec against the selected machines to perform the function. That script can simply prompt the Administrator for the password with InputBox() and then work it into the PSExec commandlines at run time. The password is not hard coded into the script that way.

:D

Makes sense. Do you by chance have any solutions I could use to guide me on the right path? Have you used these tools to install a program on all machines through the login script with no user input? Since your first reply, I have been using both PSExec and Runas on the command line trying to get this to work. Usually, if it works on the command line, it will work in a script or batch file.

Thanx again! :huggles:

Share this post


Link to post
Share on other sites

Why are you associating it with the login? That just puts you back in non-Admin user land again. The idea is to sit at the Admin workstation and run PSExec against the remote machines to install the app.

The first hurdle to overcome is this: Does the app have a silent install option? If so, it's pretty easy, if not and you have to deal with a GUI installer it's more difficult.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You can use schtask.exe to create a scheduled task that runs on user logon that will call your install script using different credentials.

Share this post


Link to post
Share on other sites

Why are you associating it with the login? That just puts you back in non-Admin user land again. The idea is to sit at the Admin workstation and run PSExec against the remote machines to install the app.

The first hurdle to overcome is this: Does the app have a silent install option? If so, it's pretty easy, if not and you have to deal with a GUI installer it's more difficult.

:huggles:

Well, in this shop they are used to rolling out apps via the login script. Users are used to it and with no user interaction. With over 200 workstations and a small IT staff, this has worked well in the past. Up to now, this has mostly involved app updates. Also, and without going into a lengthy explanation, security has been tightened so workstation users do not have admin rights.

I came along and developed a Winform app that relies on an Reflection 2008 API. I can deploy my app with no problem (so far) using AutoIt that handles any user input during the install process which has no silent install (heard of Click Once installs?). Installing Reflection from the server to the desktop results in admin issues. That's where AutoIt using RunAs (and my understanding of how it works) comes in. The Reflection setup does have a silent install but has to be an admin user.

Sorry for the lengthy explanation. Sitting at an admin workstation to install the two apps on every remote workstation won't get it.

Thanx again for your interest and ideas. :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0