Jump to content

Automating remote command


Recommended Posts

Ill try to explain this clearly so it makes sense. I am using AutoIt to cycle through a list of servers. The program turns on the rcmdsvc service using SC and copies another AutoIt script to \\server\c$\temp. It then uses rcmd (in the winnt resource kit among others) and is supposed to output a text file with some info in it. The info, specifically, is the result from cacls. So the copied over script executes cacls using run with the comspec flag. This script runs fine if you run it locally on the system. However, when run using rcmd, it fails. From what I have been able to determine, the fact that the run command with the comspec flag opens a console window (albeit hidden), makes the remote execution fail. Rcmd apparently doesnt have the ability to handle a script or exe if that script or exe opens a console of any type. My question is, "is there a way to get AutoIt to execute the cmd command in a way that doesnt require a local console?"

To clarify, the script runs fine on the remote system if I log into it and run it. However, using rcmd with the same credentials from another system fails due to this console requirement.

Link to comment
Share on other sites

In continued troubleshooting, I dont have the answer, but I do have a few more datapoints.

The script I am trying to run via rcmd remotely is called permissions.exe (compiled autoit)

The first run is a dir command, and the second run is cacls. The program never gets past the first

one (dir). My guess is because it is a component of cmd.exe and not a stand alone executable.

I put together a simple test using just cacls on a single directory. That doesnt work using rcmd, but it does

work using psexec (sysinternals/MS). So, rcmd has a problem with running both dir and cacls. psexec only has a problem with dir. cacles works under psexec.

Does anyone have any experience running an AutoIt exe using rcmd?

Link to comment
Share on other sites

Hi,

Hope I've understood your problem correctly - I'm new to this so fingers crossed!

I had a similar problem, where I was trying to start a remote application and get a handle on the window of the application GUI. I found that using PsExec (http://www.sysinternals.com/Utilities/PsExec.html) was the best way - put it on the local PC (nothing required on the remote one) and using the -i (interactive) flag, simply call a script on the remote PC - hey presto!

-Chris

Link to comment
Share on other sites

Hi,

Hope I've understood your problem correctly - I'm new to this so fingers crossed!

I had a similar problem, where I was trying to start a remote application and get a handle on the window of the application GUI. I found that using PsExec (http://www.sysinternals.com/Utilities/PsExec.html) was the best way - put it on the local PC (nothing required on the remote one) and using the -i (interactive) flag, simply call a script on the remote PC - hey presto!

-Chris

Hi Chris. Thanks for the response. What I am actually looking for is to be able to run my compiled AutoIt script on a list of servers. I want to specifically avoid having windows pop up on the remote machine. This script is pretty simple actually. Im trying to rcmd to a list of systems and run a cacls against specific directories.

You did give me an idea though. There may be a switch in PSEXEC that is kind of "opposite" of the interactive switch.. Ill have a look.

Link to comment
Share on other sites

There may be a switch in PSEXEC that is kind of "opposite" of the interactive switch.. Ill have a look.

The interactive option (the -i flag) is exactly that, an option. Just don't turn it on!

As for a list of PCs, PsExec takes in a list as one of its arguments (I believe you can add them all on the command line, or give a file listing them) - so sounds as though it might do what you want!

-Chris

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