Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Run a batch file on a remote server?
Topic Summary:
Created On: 02/26/2018 01:11 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Leonard Amabile, on Monday, March 5, 2018 12:43 PM

Answer:
The Terminal action allows you to connect a terminal window to a remote machine where you can execute batch files remotely. Automate BPA Server's agents were designed for exactly what you are describing. If adding additional agents is not an option, then you will need to look into other remote options such as:

- PowerShell (https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/running-remote-commands?view=powershell-6)
- PSExec (https://www.reich-consulting.net/site-news/use-psexec-to-execute-remote-commands/)
- SSH Terminal (http://documentation.its.umich.edu/node/350) repalce putty with Automate

Each one of the above options will work but it will take research to implement these scenarios.
 02/26/2018 01:11 PM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

We have several servers (over 20) that have a scheduled task that runs a local (on their respective C:\ drives) batch file each day, which in turn creates some files. We've been running into some issues where the file doesn't do what it should, so we have to either remote into the machine or connect to it through Task Scheduler to re-run the scheduled task.

I've created an Automate task to verify that the files have been created and are present on each server and, if not, will send an email alerting us to which servers don't have them. What I would like to do is have the Automate task launch the batch file; however, when testing this, it creates the file on the Agent server, not the target server.

Interactivity (launching a command prompt and sending the keystrokes) isn't an option, unfortunately. We need this to run behind the scenes.

Is there some way to either run the batch file so it creates the files on the target server or run the scheduled task set up in Windows Task Scheduler?

 Category Survey


Edited: 03/01/2018 at 06:00 AM by JacobNielsen
 03/05/2018 04:53 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Jacob,

Are these Windows machines? You could try using the Terminal action to SSH to each machine to execute the batch file. If that is not an option, then you may need to add agents to these remote machines.

 Category Survey


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 03/05/2018 07:25 AM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

They are Windows machines. I'm not familiar with the Terminal action; could you please elaborate a bit?

Some information: these are virtual machines on the network and they don't have any users logged in when the task is initially running. So how would we use the Terminal action to connect to the machine and run the batch file?

Alternatively, is there any way to use Automate to launch the scheduled task that we have set up in Task Scheduler? Without adding Agents, that is; that isn't a viable option for us.

 Category Survey
 03/05/2018 08:19 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Answer Answer
The Terminal action allows you to connect a terminal window to a remote machine where you can execute batch files remotely. Automate BPA Server's agents were designed for exactly what you are describing. If adding additional agents is not an option, then you will need to look into other remote options such as:

- PowerShell (https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/running-remote-commands?view=powershell-6)
- PSExec (https://www.reich-consulting.net/site-news/use-psexec-to-execute-remote-commands/)
- SSH Terminal (http://documentation.its.umich.edu/node/350) repalce putty with Automate

Each one of the above options will work but it will take research to implement these scenarios.

 Category Survey


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 03/05/2018 12:44 PM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

Thank you for the information! The answer did indeed reside in PowerShell, as I was able to find a way to run the batch remotely using that.

Edit: well, test files, anyway. We'll see about the actual thing tomorrow.

Thanks again!

 Category Survey
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 245 guests browsing this forum, which makes a total of 245 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2019 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog