Starting a windows batch file on a remote computer with "External SSH Tool" ?

I want start a windows batch file on a remote computer which generates a csv file of pictures in our PIM system. This batch file an only executed on the remote computer.

Can I use for that the External SSH Tool? Has then the External SSH Tool the same behave as the External Tool (for local calls) and wait until the execute of the batch file is finished?

Hi @m_amann

If you enable SSH on your Windows Machine this could work… in theory. I haven’t personally tried to setup SSH on a Windows Machine.

Regards,
Wali

1 Like

Thank you! During I have found a another solution via “External Tool” in combination with Powershell script. Powershell can more as a normal batch. There you can connect to another machine and you see the script running with progress as it would running locally.

Setting example in “External Tool”:

image

The Powershell script contains following for example:

$Username = ‘[domain name][user name]’
$Password = ‘[password]’
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass

Invoke-Command -ComputerName "[computer name]" -credential $cred -ErrorAction Stop -ScriptBlock {
	Invoke-Expression -Command:"cmd.exe /c 'X:\Temp\ToDo.bat'"
}

The “X:\Temp\ToDo.bat” is running on the remote machine, but the output is locally in your computer. Only if the script is finished, the “External Tool” node is finished too and goes to green.

But you must set the policy on your local machine before the script can running remote. For that you must login with a administrator account.

Set-ExecutionPolicy [Richtlinie] -force

see more here: Windows: Powershell-Skript ausfĂźhren

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.