Running a Command Line call on a remote system

Post Reply
cstevens
Member
Posts: 40
Joined: Tue Feb 12, 2013 8:42 pm

Running a Command Line call on a remote system

Post by cstevens »

I have an application running on a remote server from switch which has a command line interface. Can anyone think of a way to call it remotely from switch along with some parameter data from within the flow?

For example if I was on the remote server I would call something like:

"C:\Program Files\Acme\Interface.exe" -input C:\Shared\Switch_Input\<job name> -parameter <switch metadata>

where <job name> was the switch job name, and <switch metadata> was some internal metadata value for that job.

The only thing I can think of is to create a batch script on a share on the remote server that takes a couple of input parameters and re-formats a local command call to do this call locally, but that seems clunky and difficult to get any usable error response.

Wondering if anyone has tried psexec or something like that from the scripting interface in switch.
sander
Advanced member
Posts: 228
Joined: Wed Oct 01, 2014 8:58 am
Location: The Netherlands

Re: Running a Command Line call on a remote system

Post by sander »

For Windows I would go for PowerShell instead of psexec. Looks like invoke-command is what you are looking for;
https://technet.microsoft.com/en-us/lib ... 47578.aspx

I used PowerShell a lot, but changed job 1.5 year ago, so I've to dig but something like this should get you started (untested);
invoke-command -ComputerName APPL03 -ScriptBlock { 'c:\windows\system32\ping.exe -4' }

To save you some time getting PowerShell to start within Switch, this might be a handy screenshot, I'm using it to start a ps1 script (similar to batch .cmd), but it should get you started to execute something.
Image

Now I'm thinking of it, your idea of creating a batch script is great. Translate it to a PowerShell equivalant which you can run locally on the Switch server, but do remote execution. I bet you can capture all the output logging in Switch then.
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.

Chat: open-automation @ gitter
Post Reply