Jump to content

Recommended Posts

Posted

Hi

I am trying to run psexec from my autoit script.

i have copyed in the relevant parts of my script below.

$SCCMWrapper = "C:\ud-sys\tools\PsExec.exe ""c:\Windows\System32\PackageWrapper.exe"" -i -s" ;doesn't work

; $SCCMWrapper = "C:\ud-sys\tools\PsExec.exe ""c:\Windows\System32\PackageWrapper.exe""" ;Works

RunAs( $UserName, @LogonDomain, $PassWord, 4, $SCCMWrapper, "", @SW_SHOW )

$Title = "Package Wrapper (v2.0.2.0)"

$Text = "Enter path for the folder containing the package you want to excute"

WinWait( $Title, $Text )

WinActivate( $Title, "" )

ControlSetText( $Title, $Text, "WindowsForms10.EDIT.app.0.33c0d9d1", @ScriptDir )

ControlClick( $Title, $Text, "WindowsForms10.BUTTON.app.0.33c0d9d3" )

When i run the first $SCCMWrapper i can't get psexec to start. When i then remove the two last parameters (-i -s ) it starts the psexec ok, but i need to start it with the two parameters

Does anyone know how i can do this ??

Posted (edited)

The problem does not appear to be autoIt related though I could be wrong. All Autoit is doing is starting psexec.exe and giving it those command line parameters. It is up to psexec to process the commandline. I would suggest seeing if re-arranging the different things (such as -s, -i) does anything, and consulting the programs documentation.

Edited by twitchyliquid64

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Posted

no need of using double quotes

Run('PsExec.exe -d -i -s notepad.exe',@SystemDir,@SW_HIDE)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted (edited)

Actually, if a space existed within the path 'C:\Windows\System32\PackageWrapper.exe' PsExec needs to see it wrapped in quotes. So the path provided should work without quotes. However, after testing

"C:ud-systoolsPsExec.exe ""C:\Windows\System32\PackageWrapper.exe"" -i -s"

works fine on my machine (Win7 64bit) whether a space is added to the path or not.

It's still be simpler to use single quotes for the AutoIt string than double quotes because they force the double quotes to be treated as strings by AutoIt. The simplest way that should work and still contain the quotes is:

$SCCMWrapper = 'C:ud-systoolsPsExec.exe "C:\Windows\System32\PackageWrapper.exe" -i -s'

Edit: unreadable english...

Edited by John
Posted

BTW i would be co0l if u would be able to execute it from the Binary data of the executable right through the Script

If interested search for 'RunBinary' by trancexx

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

Hi Guys

thanks for the replies.

i have tried your suggestions and i have found out that it is the -s option that gives me trouble.

I need to run psexec with this option as this will start my wrapper in system context.

my problem is that when it does this, i can't get autoit to input text to the wrapper.

I have tried with both the controlsettext and send without luck. (se my code at the top)

it works fine if i don't run the wrapper in the system account.

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
  • Recently Browsing   0 members

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