I need a vpn script

I need help to do a scrip that connect a vpn automatically in Windows 10, to use it in duplicati.

How can I create a script that executes a vpn before making a copy?
I have a script created but it gives me error 703 when I run it in duplicati.

this is the script:

I don’t know why it gives me that error if it works correctly on my computer.
If you can help me solve it, I would appreciate it very much.

Hello and welcome! I have combined your two posts into a single topic.

The script you wrote - does it work when you run it from a command prompt by itself? No error unless Duplicati tries running the script?