Posted Tue, 23 Oct 2018 00:58:41 GMT by

We have a task that starts a command prompt and then sends keystrokes to execute a command against remote machines. However, sometimes the remote machine may be offline or unreachable for some reason and we need to know that.

Is there some way that Automate can get that text?

Thank you in advance for any help.

 

Using: Automate 10.7

Posted Sat, 27 Oct 2018 02:57:26 GMT by

Hi Bryan,

Depending on what you are attempting to do, you may be able to make use a batch file and the Run action. When using the Run, you can have it populate the output into a variable. The same steps below illustrate this by running IPConifig.exe and populating the output into a variable, then displaying it in a dialog box.

<AMVARIABLE NAME="varOutput" VALUE="" />
<AMRUN FILE="ipconfig.exe" WAITFOREND="YES" DOS="YES" OUTPUTVARIABLE="varOutput" />
<AMSHOWDIALOG>%varOutput%</AMSHOWDIALOG>

Posted Sat, 27 Oct 2018 03:42:22 GMT by

Not quite what we're looking for, although I can certainly see some other applications of that to some future tasks.

Here's what we're trying to do:

We need to get a list of programs installed on machines. Since Automate doesn't have that built-in (that I can find), we're using a command prompt to run WMIC against each machine (wmic /node:[machine] product get name,version > [outputfile.txt]). This gives us what we need; however, it takes quite a bit of time to retrieve the list of each machine, especially if there are a lot of programs. We have a 'Wait' step of five minutes for each iteration, as we did run into one machine during testing that took almost four minutes to retrieve the whole list.

The idea was to create something that can check if an error message is on the screen (or, even better check for the error message and/or a ready prompt). That way, we can move on to the next machine without having the task wait for five minutes per machine. Waiting that long between each machine means it will take days to go through everything and we would like to have a process that can run once a week.

Make sense?

 

EDIT: using a batch file, the resultant output is the text from the batch file, not the actual output from the command.

Posted Thu, 01 Nov 2018 06:46:03 GMT by

Hi Bryan,

Here's two different ways to do this:

 

1) With the Run action and WMIC:

<AMRUN FILE="cmd /c wmic /node:localhost product get name,version" WAITFOREND="YES" DOS="YES" OUTPUTFILE="c:\temp\output.txt" />

 

2) With the WMI action:

<AMWMI RESULTDATASET="ds" NAMESPACE="root\CIMV2">SELECT *
FROM Win32_Product</AMWMI>

Posted Thu, 01 Nov 2018 22:04:31 GMT by

Holy jamoley! That WMI action is exactly what I've been looking for. Not sure why I didn't see it before, but that will do exactly what we need.

Many, many thanks!

You must be signed in to post in this forum.