ssh-action
ssh-action copied to clipboard
Unable to run multiple commands on windows servers
Unable to run multiple commands on windows server. Only the first command is getting executed.
- name: SSH to Windows Node
uses: appleboy/ssh-action@1a8b3784eaa665f677fa114edd5683bb6a6bfaa8 # master hash on July 12, 2021 (newer than v0.1.4)
continue-on-error: true
with:
script: |
powershell.exe
$service = Get-Service twistlockDefender -ErrorAction SilentlyContinue
$script={ if ("$args[0]" -match "Running") { echo 'Service Already Installed' } else { echo 'Service Installation Needed' }}
powershell.exe -Command $script -args $service.status
host: << HOST_IP >>
username: << HOST_USERNAME >>
password: << HOST_PASSWORD >>