Jump to content

Autoit native function like PSEXEC?


DrLarch
 Share

Recommended Posts

I use psexec a LOT in my Autoit programs. But it is a pain dealing with as far as getting feedback. One can get feedback from the cmd line but it's clunky, and, AFAIK it's very difficult (impossible?) to get cmd line feedback running interactively (-i). Yeah, an Autoit exe can write data to a file (or even by sending back over the network) which can be read by a parent script, but that's clunky as well.

So is there any kind of native functionality available in Autoit for doing what PSEXEC does? I found this old thread which asked the same question (which went unanswered), so wanted to throw this out there again.

I have found out about a few other utilities like remcom (old and Sourceforge says it contains malware) and PSAEXEC (open source non-MS implementation of PSEXEC). But it would sure be nice if there was some way of doing this natively in Autoit.

Thanks

Edited by DrLarch
Link to comment
Share on other sites

psexec works by installing a service on the target machine, which runs under the local SYSTEM account. this service then executes a program (or communicate with the remote machine, or do pretty much anything). when the program exits, the service uninstalls itself.

each of these tasks can be written in pure AutoIt, then combined into a single utility.

good luck!

EDIT: or learn how to work with psexec, and deal with its limitations.

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

11 hours ago, orbs said:

psexec works by installing a service on the target machine, which runs under the local SYSTEM account. this service then executes a program (or communicate with the remote machine, or do pretty much anything). when the program exits, the service uninstalls itself

Hmm... good to know. Thanks for that orbs. But regarding running as SYSTEM, I thought that only applied if using the -s switch. But maybe it always does run as SYSTEM, but launches the executable separately according to the psexec params (ie. -i [session])?

11 hours ago, orbs said:

each of these tasks can be written in pure AutoIt

I'm sure this can be done, but am under the impression that's a bit beyond me currently. That said, the paexec source is available and could be studied to determine the exact mechanisms used. Who knows, maybe if I get more time I can start digging into this. I was actually kind of wondering if any UDF's are out there already, but looks like that isn't the case. No big deal, though. I've already been playing with the TCP listen and send functions more. With those, it's looking very doable to get where I want to go. So like you said, short term I'm going to be working around psexec's limitations, and hopefully long term I can come up with something native.

11 hours ago, Chimp said:

... maybe something like this

Thanks Chimp. Wondering if WMI is what psexec is using to do its thing?

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