Jump to content

RunAsSet


Recommended Posts

Hi there,

After a bit of advice; Basically, I want to run a program through a login script to install some software with Admin rights. I am working with a domain environment.

ok, Lets say the domain is called DOM1 and I have created a domain administrator account for running scripts called ScriptAdmin with the password password

The program to run is called INSTALL.EXE and is located on a PC called APPS in a network folder shared as SHARE

Would I be right to say I could then use the following commands ?

RunAsSet("ScriptAdmin", "DOM1", "password")

RunWait("\\APPS\SHARE\INSTALL.EXE", "", @SW_HIDE)

Then, also ... could I add the next command to lock keyboard and mouse input whilst it is installing .. so as to take away the ability to stop the app installing. ?

MsgBox(1, "Installer Title", "Please wait while a program is installed. Keyboard and Mouse Input will be disabled temporarily. This box will timeout in 5 seconds", 5)

BlockInput(1)

;script here

BlockInput(0)

Thanks for your time :D

Edited by ErinC
Link to comment
Share on other sites

There's nothing there that looks wrong, have you tried it? The one thing I'd suggest is using a SplashTextOn for you notification, then leave it on through the install.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Hello, and thanks for your reply emmanuel.

Yes, I have tried it, but I am getting errors from the users when they logon.

I got rid of the message and the lock mouse/kbd and changed the script to read roughly as follows;

RunAsSet("ScriptAdmin", "DOM1", "password")
Run("\\APPS\SHARE\INSTALL.EXE", "", @SW_HIDE)
RunAsSet()
exit

Now, when users log on, I am seeing an AutoIt Error at Line0:

Error: Unable to execute the external program.

The directory name is invalid.

But once they are logged on, they can click Start->Run and type the above path to the exe file and it works ok. !? Someone please help .. I need to get this working pronto ! :D

Link to comment
Share on other sites

  • Developers

i prefer to do it this way to avoid issues like this:

Fileinstall("install.exe", @TempDir & "\install.exe")
RunAsSet("ScriptAdmin", "DOM1", "password")
RunWait(@TempDir & "\install.exe", "", @SW_HIDE)
FileDelete(@TempDir & "\install.exe")

SciTE4AutoIt3 Full installer Download page Ā  -Ā Beta filesĀ  Ā  Ā  Ā Read before postingĀ  Ā  Ā How to post scriptsourceĀ Ā Ā Forum etiquetteĀ  Forum RulesĀ 
Ā 
Live for the present,
Dream of the future,
Learn from the past.
Ā  :)

Link to comment
Share on other sites

Thanks for the prompt reply JdeB !

But wouldn't the Fileinstall command come after the RunAsSet command ?

Another thought I just had is that there are other files in the network folder that will be needed when installing .. how/will this work ?

Edited by ErinC
Link to comment
Share on other sites

  • Developers

Thanks for the prompt reply JdeB !

But wouldn't the Fileinstall command come after the RunAsSet command ?

Another thought I just had is that there are other files in the network folder that will be needed when installing .. how/will this work ?

I generally do a fileinstall for all files needed. This also enables you to run it in "StandAlone" mode".

Doesn't matter where the fileinstall is place in this case because the RunAsSet only does something for the RunWait command.. no other commands in the script run with the ScriptAdmin credentials. When thats needed, you wil have to restart your own script under these credentials. see this post: #17603

SciTE4AutoIt3 Full installer Download page Ā  -Ā Beta filesĀ  Ā  Ā  Ā Read before postingĀ  Ā  Ā How to post scriptsourceĀ Ā Ā Forum etiquetteĀ  Forum RulesĀ 
Ā 
Live for the present,
Dream of the future,
Learn from the past.
Ā  :)

Link to comment
Share on other sites

That's great JdeB,

So, just to clarify ... I should add an extra FileInstall ... command for every file that the Install.exe needs ? (so they are all integrated into the AutoIt .exe)

This would presumably mean that the compiled file I end up with will be relatively large .. which may pose a problem for some of my network users that are on slower links to the domain (isdn for instance) I will have to test this.

I'll probably not have time to test it properly until Monday/Tuesday now .. I'll be sure to post back though.

Thanks again for your time and effort :D

Link to comment
Share on other sites

  • Developers

So, just to clarify ... I should add an extra FileInstall ... command for every file that the Install.exe needs ? (so they are all integrated into the AutoIt .exe)

yes .. correct

This would presumably mean that the compiled file I end up with will be relatively large .. which may pose a problem for some of my network users that are on slower links to the domain (isdn for instance) I will have to test this.

:D Lost you here... what is the difference between first downloading a BIG compiled script, or a small script running executable over the network that are big ?

They will all have to be download to the pc first before they can be executed.. right ?

One nice thing about including them in the AutoIt3 script is that the total package is often smaller that the original files because of the compression done by the compiler.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page Ā  -Ā Beta filesĀ  Ā  Ā  Ā Read before postingĀ  Ā  Ā How to post scriptsourceĀ Ā Ā Forum etiquetteĀ  Forum RulesĀ 
Ā 
Live for the present,
Dream of the future,
Learn from the past.
Ā  :)

Link to comment
Share on other sites

Yes, I understand what you are saying JdeB, and it will be interesting to see how much compression is achieved, but the very nature of the app I am installing means that it will (it has to) run every time any user logs on.

The installer first checks to see if it is already installed, if so, it simply exits. If not, then it installs.

This way, only the install.exe is transferred over the network (if the client is already installed)

By integrating all the install files into the file that gets copied over the network, this will result in increased network traffic. And in a network like the one I am working with (a few thousand users), that's significant. :D

Unfortunately, I didn't originally setup the install files in the network share, and I can't currently tell which files are completely required ! aaargh nothings ever easy is it ?! esp on a Friday afternoon :huh2:

Edited by ErinC
Link to comment
Share on other sites

so, why don't you write one script that checks if the app is there, and then have it kick off the other larger one only when needed?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Of course !

But this is getting a lot more convoluted for what should be a simple thing !!

I'd much rather get my original script that I posted at the top fixed. :D

thanks for the suggestion emmanuel :huh2:

Link to comment
Share on other sites

Hi again,

I have taken emmanuels advice and created another script to check for the presence of the client app. This script.exe then calls the second script.exe if no client is found .. the second script includes the required files and is 756 KB .. so, not tooo bad :D

Going to test tomorrow .. I am hopeful so keep your fingers crossed ! :)

edit: what's going on with the times here ?? It's half twelve am here .. not 3:30 PM :huh2:

Edited by ErinC
Link to comment
Share on other sites

what's going on with the times here ??Ā  It's half twelve am here .. not 3:30 PM

In the Control Panel under the Board Settings you can set your time zone, and daylight savings (if the contry you live in uses it.) Once these are set, it should translate times into your local time instead of the forum default.

Edited to change the quote format

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Don't know if this thread has died, but... Some notes on RunAsSet() :

Now, when users log on, I am seeing an AutoIt Error at Line0:

Error: Unable to execute the external program.

The directory name is invalid.

Don't know if you've resolved this yet, but this is something that comes from using RunAsSet() and not specifying a working dir in a following Run() function.

Also, when using RunAsSet() I always always place the password string in a variable prior to the RunAsSet() function:

$passWord = "sesame"
RunAsSet("superuser", "THEDOM", $passWord)

If an AutoIt script ("compiled" or not) throws an error the default behavior is to show the text of the line it broke on, so there's a chance that an error would show your password in-the-clear. Only thing I know that would cause this would be a syntax error in RunAsSet() , but there's no harm in being safeĀ®...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Thank you for your post DaveF .. much appreciated.

I have still not resolved this yet, mainly because of time constraints at work ... there's always something else more pressing ! I'll get there eventually.

My apologies for not replying here for the benefit of the other people who were so good to give their time to contribute to this thread. I WILL persevere !

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...