Jump to content

RunAsSet Giving Me Strange Results


Recommended Posts

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?

Link to comment
Share on other sites

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Developers

You didn't specify how the script is started with the system account... are you using the Scheduler ?

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

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)

Link to comment
Share on other sites

  • Developers

Ok... I can simulate it by using the AT command:

c:>at 18:54 /interactive  "C:\temp\script.exe"

Will do some testing.

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

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 3 weeks later...

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

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...