Hi ACL Services Team,
Apologies for the lates response on this topic.
You may check this link on how to create a command line script for your On-Prem agent: https://docs.workato.com/on-prem/profile.html#command-line-scripts-profile
Also, regarding this issue, may we know if you are using Workato as a normal user? If there are different admin rights, then the script might fail.
For future reference on how to run Powershell script through command line scripts profile, since this comes up as one of the few results in Google for Powershell usage in Workato.
1. Set execution policy to RemoteSigned, with local machine scope in an administrative Powershell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
2. yaml file setting (that worked for me):
command_line_scripts: Developer_1: concurrency_limit: 3 timeout: 30 scripts: server_stats: name: Get Server Stats command: - 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' - '<path to file directory>\developerlab2.ps1 -input_stats {{type}}' parameters: - { name: type }
3. Start of ps file
Param( [Parameter(Mandatory=$True,Position=1)] [string]$input_stats, [switch]$force = $false )
Send us a ticket, we will try our best to assist you with your problem
ACL Services Ltd.
On-Prem command line script
Hi,
I have an on-prem agent installed and am trying to execute a powershell ps1 script. I have tested it locally without Workato by using >PowerShell.exe -file "C:\Documents\test.ps1" and it works.
command_line_scripts:
test_profile:
concurrency_limit: 3
scripts:
test_script:
name: test_script
command:
- 'C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -file C:\Documents\test.ps1'
But I am getting a weird error:
Cannot run program "C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -file C:\Documents\test.ps1": CreateProcess error=2, The system cannot find the file specified
I have tried double black slashes, forward slashes, back slashes....and all get errors. Anyone has used workato to execute a powershell script?
2 people have this question