jonathanvh
Enthusiast
Enthusiast

Recovery Plans: Command: SRM script

Jump to solution

Hi,

I have a question about the action "Command: SRM script" when executing a Recovery Plan.

We have both Windows SRM servers and Linux SRM servers, SRA reasons that are only compatible with Linux and Windows.

We have some actions that we need to do after each Recovery Plan.

We've created a Workflow in vRealize Orchestrator for this.

And now we want to start this automated when the Recovery Plan is launched.

I want to use curl because this will work on Windows and Linux, and I want to have just 1 command to work on.

this is the command that works in cmd.

curl --location --request POST "https://ORCHESTRATOR:8281/vco/api/workflows/ab0711a2-19a3-4622-83dc-fcdb5c8943ab/executions/" --header "Content-Type: application/json" --header "Authorization: Basic xxxxxxxxx=" --data-raw "{     \"parameters\": [         {             \"value\": {                 \"string\": {                     \"value\": \"TEXT\"                 }             },             \"type\": \"string\",             \"name\": \"CI_virp_input\",             \"scope\": \"local\"         }     ] }" --insecure

But via SRM it is not working.

0 Kudos
1 Solution

Accepted Solutions
jonathanvh
Enthusiast
Enthusiast

So I managed to have this working.

Start Powershell as administrator

cp "C:\Windows\System32\OpenSSH\ssh.exe" "E:\Program Files\VMware\VMware vCenter Site Recovery Manager\bin\" #or where ever you have installed SRM

cd "E:\Program Files\VMware\VMware vCenter Site Recovery Manager\bin\"

mkdir “C:\Windows\System32\config\systemprofile\.ssh”

Copy your private key to: "C:\Windows\System32\config\systemprofile\.ssh"

The permissions on this file must be like this:

2020-07-22 12_25_56-Window.png

And this is the command that you should put in the SRM Recovery Plan:

ssh.exe srm@orchestrator python startVroWF.py

For a verbose output do this; so you know what goes wrong.

ssh.exe -v -E c:\tmp\log.txt srm@orchestrator python startVroWF.py

View solution in original post

0 Kudos
2 Replies
jonathanvh
Enthusiast
Enthusiast

Just a quick update

I checked the logs and I have the curl working on both Linux and Windows via Command on SRM Server.

But the way Windows and Linux SRM handle the command I can't use it. I want 1 command that will work on Linux and Windows

After a lot of trying I've found out that you need to pass the Windows command like this (at least via SRM):

Windows CMD

curl.exe --location --request POST "https://orchestrator:8281/vco/api/workflows/ab0711a2-19a3-4622-83dc-fcdb5c8943ab/executions/" --header "Authorization: Basic xxxxxxx" --header "Content-Type: application/json" --data-raw "{"parameters": [{"value": {"string": { "value": "TEST"}},"type": "string","name": "CI_virp_input","scope": "local"}] }" --insecure

And the Linux command like this: (check the \ before the quotes)

Linux CMD (I did a ln -s /bin/curl curl.exe)

curl.exe --location --request POST "https://orchestrator:8281/vco/api/workflows/ab0711a2-19a3-4622-83dc-fcdb5c8943ab/executions/" --header "Authorization: Basic xxxxxxx" --header "Content-Type: application/json" --data-raw "{   \"parameters\":[      {         \"value\":{            \"string\":{               \"value\":\"BLABLABLA\"            }         },         \"type\":\"string\",         \"name\":\"CI_virp_input\",         \"scope\":\"local\"      }   ]}" --insecure

And I've also tried with single quotes on the data-raw part, but this does not work on Windows. And the JSON code needs double quotations.

So I gave up on the curl command.

And now I'm trying to do it via ssh.

This also works on Linux and Windows.

Something like this: (again a "ln" on Linux)

ssh.exe -o StrictHostKeyChecking=no -i key user@orchestratator python startVroWF.py

On Linux it is working flawlessly but on Windows the command just runs for 5 minutes and then times out...

I see it running in the task manager. But I need to figure it out why it doesn't work.

If I execute it manually in cmd it works like a charm...

Any help will be useful.

0 Kudos
jonathanvh
Enthusiast
Enthusiast

So I managed to have this working.

Start Powershell as administrator

cp "C:\Windows\System32\OpenSSH\ssh.exe" "E:\Program Files\VMware\VMware vCenter Site Recovery Manager\bin\" #or where ever you have installed SRM

cd "E:\Program Files\VMware\VMware vCenter Site Recovery Manager\bin\"

mkdir “C:\Windows\System32\config\systemprofile\.ssh”

Copy your private key to: "C:\Windows\System32\config\systemprofile\.ssh"

The permissions on this file must be like this:

2020-07-22 12_25_56-Window.png

And this is the command that you should put in the SRM Recovery Plan:

ssh.exe srm@orchestrator python startVroWF.py

For a verbose output do this; so you know what goes wrong.

ssh.exe -v -E c:\tmp\log.txt srm@orchestrator python startVroWF.py

View solution in original post

0 Kudos