Jump to content
Sign in to follow this  
buymeapc

RunAsSet Giving Me Strange Results

Recommended Posts

buymeapc

Ok, this should be pretty simple, but I'm slamming my head into a wall. I have a script that is being run by the SYSTEM account, but I need it to launch applications using a local admin account.

I've dumbed the script down to its most simple level.

RunAsSet("station100", @ComputerName, "password")


Run("notepad.exe", @SystemDir)

In return, I keep getting:

Line -1:

Error: Unable to execute the external program.

Access is Denied.

What am I doing wrong?

Share this post


Link to post
Share on other sites
Jos

Ok, this should be pretty simple, but I'm slamming my head into a wall. I have a script that is being run by the SYSTEM account, but I need it to launch applications using a local admin account.

I've dumbed the script down to its most simple level.

RunAsSet("station100", @ComputerName, "password")


Run("notepad.exe", @SystemDir)

In return, I keep getting:

Line -1:

Error: Unable to execute the external program.

Access is Denied.

What am I doing wrong?

Try specifying the whole path to the program you are starting:

Run(@SystemDir & "\notepad.exe", @SystemDir)

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

Share this post


Link to post
Share on other sites
buymeapc

Ok, now I'm getting:

Line -1:

Error: Unable to execute the external program.

The parameter is incorrect.

Edit: Ooops...I forgot the "\" in front of the notepad.exe. I am still getting the same results as before. I also checked the Secondary Login Service to see if it's running and it is.

I'm not sure why this is happening...

Edited by buymeapc

Share this post


Link to post
Share on other sites
buymeapc

Sorry for the bump, but I'm really stumped on this one and can't get past it.

Share this post


Link to post
Share on other sites
Jos

Did you use the line exactly as I typed ?

How are you starting the script ?

Does the script work when executed by your own account on the PC?

Jos

Edited by Jos

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

Share this post


Link to post
Share on other sites
buymeapc

The code I am using is:

RunAsSet("station100", @ComputerName, "password")


Run(@SystemDir & "\notepad.exe", @SystemDir)

I copied/pasted your line of code into my script. The script works fine when executed as the local admin account - everything works great that way, but it is instead being automatically run by the SYSTEM account which causes this error.

Share this post


Link to post
Share on other sites
buymeapc

Oh, I'm sorry....

I'm using a program called DeepFreeze made by Faronics. It has a built in batch file that can call files located on the drive. I'm calling the script using this command:

START "" "C:\SetUp Apps\Dyna-Update\Dyna-Update.exe"

I use the "" so that the command prompt box disappears while the script is executing (so the window doesn't get in the way)

Share this post


Link to post
Share on other sites
buymeapc

Ok, thanks....I'm still trying things on my end, too.

Share this post


Link to post
Share on other sites
Jos

Wondering if it is allowed at all to change the credentials when running under the SYSTEM account.

Does anybody know or have any experience with this ?


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

Share this post


Link to post
Share on other sites
buymeapc

There is an option under DeepFreeze, but I have had no luck at all with it, so I figured I'd try it in the script I am using - and here I am lol.

Share this post


Link to post
Share on other sites
Jos

Just tried the following scenario to test my previous point:

1. Schedule CMD with AT to run the command prompt with SYSTEM credentials: at 19:39 /interactive "cmd.exe"

2. In the opened CMD prompt try running RunAs.

This gives the error: " 5: Access is denied."


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

Share this post


Link to post
Share on other sites
buymeapc

So, is there any way to make this work in your opinion?

Share this post


Link to post
Share on other sites
Kudzu309

Looks like RunAsSet is in the 3.2.10 help file but it doesn't exist in the API: http://svn.autoitscript.com/trac/ticket/174. It is fixed in the 3.2.12 beta:

16th May, 2008 - v3.2.12.0

AutoIt:

Removed: Unnecessary optional parameter from ProcessClose().

Removed: RunAsSet(). (Replaced with RunAs() and RunAsWait())

etc...

...but in the BugTrack it says that 3.2.10 supports RunAs, so here's the syntax if you don't want to load the beta:

RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Steve

Share this post


Link to post
Share on other sites
AHarkeyCCS

Hello all,

I found that this works well.

if not IsAdmin()Then

Local $pid = runaswait("administrator", @computername, "**", 0, "\\ServerName\nonmsipkg\dvd\setup.exe /s",@SystemDir)

ProcessWaitClose($pid)

elseif IsAdmin() Then

Run("Setup.exe",@Scriptdir)

EndIf

The Error 1 is because your testing you script with admin right to the workstation. You will need an

If IsAdmin() Then

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  

×