Jump to content

RunAs / RunAsWait


Recommended Posts

#Include <File.au3>
#Include <Array.au3>

    $i = 1
    $Array =_FileListToArray("X:\IT\SOE EXE")
    If @Error = 1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit    
    EndIf
    
    For $Count = 1 To UBound($Array) - 1
    $Program = $Array[$i]
    $i = $i + 1
    RunWait("X:\IT\SOE EXE\" & $Program)
    Next

This is a very simple code that works for me to build a list of .exe files i have made for programs for a Standard operating environment using Auto It and this will run them one at a time but on our network it needs special privileges to install so.

#Include <File.au3>
#Include <Array.au3>

Local $UserName = "Username"
Local $Password = "Password"
Local $Domain = "Domain"

    $i = 1
    $Array =_FileListToArray("X:\IT\SOE EXE")
    If @Error = 1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit    
    EndIf
    
    For $Count = 1 To UBound($Array) - 1
    $Program = $Array[$i]
    $i = $i + 1
    RunAsWait($UserName, $Domain, $Password, 0,$Program, "X:\IT\SOE EXE\")
    
    Next

I have tried this and it does not work. And before anyone points it out yes i know the Username, Password and Domain are not specified here does anyone have any reason why this does not work properly i want to get it to run as a user i have created that has the proper privileges any help would be great thanks all

Link to comment
Share on other sites

#Include <File.au3>
#Include <Array.au3>

    $i = 1
    $Array =_FileListToArray("X:\IT\SOE EXE")
    If @Error = 1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit    
    EndIf
    
    For $Count = 1 To UBound($Array) - 1
    $Program = $Array[$i]
    $i = $i + 1
    RunWait("X:\IT\SOE EXE\" & $Program)
    Next

This is a very simple code that works for me to build a list of .exe files i have made for programs for a Standard operating environment using Auto It and this will run them one at a time but on our network it needs special privileges to install so.

#Include <File.au3>
#Include <Array.au3>

Local $UserName = "Username"
Local $Password = "Password"
Local $Domain = "Domain"

    $i = 1
    $Array =_FileListToArray("X:\IT\SOE EXE")
    If @Error = 1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit    
    EndIf
    
    For $Count = 1 To UBound($Array) - 1
    $Program = $Array[$i]
    $i = $i + 1
    RunAsWait($UserName, $Domain, $Password, 0,$Program, "X:\IT\SOE EXE\")
    
    Next

I have tried this and it does not work. And before anyone points it out yes i know the Username, Password and Domain are not specified here does anyone have any reason why this does not work properly i want to get it to run as a user i have created that has the proper privileges any help would be great thanks all

Hi,

only some guesses:

1) you should try another logon_flag

2) The runas user has access, minimum read and execute, to X:\IT\SOE EXE directory ? You may need write access.

3) the Secondary Logon (RunAs) service must be running

;-))

Stefan

Link to comment
Share on other sites

Its not that the specified user will need access over the folder but to install programs on the desktop that the user is using so atm its just the Network Admin that has the ability to install programs the user i made will have the same rights or atleast enough rights to run the script which will grab the .exe and run/install it. Would you suggest using RunAsWait on the other scripts to run the file

So here how it looks

Main script builds list of .exe files ( compiled scripts that run the proper .exe file from the server ) so there's 2 stages of scripts. Will the script that picks up the .exe file and runs through the install process need to be RunAs or will that apply when using RunAs on the initial script/.exe and how does The Secondary Logon (RunAs) service work again. i will most probably remember after i close this and the forum lol but indulge me anyway

Link to comment
Share on other sites

  • 2 weeks later...

Hello. I am using similar scripts and runas.

We are working a domain. Our peopele working with user rights. they are not administrator of computers.

In my program if I want to install a program I am using runaswait.

my problem is I want to create a file in c:\windows\xxx.ini but users has not access there. I need admin rights.

or I want to change some line in win.ini. I cant change because user has not right there.

what must I do for that kind of problems.

Before program as got runasset. runasset deleted in the program.

thanks

Fatih

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

Hello. I am using similar scripts and runas.

We are working a domain. Our peopele working with user rights. they are not administrator of computers.

In my program if I want to install a program I am using runaswait.

my problem is I want to create a file in c:\windows\xxx.ini but users has not access there. I need admin rights.

or I want to change some line in win.ini. I cant change because user has not right there.

what must I do for that kind of problems.

Before program as got runasset. runasset deleted in the program.

thanks

Fatih

Hi,

maybe not very elelgant:

1) RunasWait with Admin Account (this will create ini file in windows directory with a !! carriage return !! in first line)

echo. > c:\windows\<filename ini File>

2) RunasWait with Admin Account (this will give user write access to ini file)

cacls c:\windows\<filename ini File> /E /G domain\username:c

3) make the changes to ini file with user credentials, remember CR in 1st line of ini file

4) RunasWait with Admin Account (this will remove user write access to ini file)

cacls c:\windows\<filename ini File> /E /R domain\username

5) If you have blanks in your username, you have to use "username".

6) you may use %windir% instead of c:\windows

7) to make changes in win.ini file start at point 2 with win.ini as filename.

This may help you so far, even it is windows cmd based.

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

I found a small solution.

I made to program.

1. Program Runaswait($username,$domain,$password,0,$programlink,@systemdir)....

2. program IT can be everything. Because it is working with runas...

Hi,

maybe not very elelgant:

1) RunasWait with Admin Account (this will create ini file in windows directory with a !! carriage return !! in first line)

echo. > c:\windows\<filename ini File>

2) RunasWait with Admin Account (this will give user write access to ini file)

cacls c:\windows\<filename ini File> /E /G domain\username:c

3) make the changes to ini file with user credentials, remember CR in 1st line of ini file

4) RunasWait with Admin Account (this will remove user write access to ini file)

cacls c:\windows\<filename ini File> /E /R domain\username

5) If you have blanks in your username, you have to use "username".

6) you may use %windir% instead of c:\windows

7) to make changes in win.ini file start at point 2 with win.ini as filename.

This may help you so far, even it is windows cmd based.

;-))

Stefan

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
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...