* Automatically connect to an OpenVPN server with the command: & "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --command connect $ovpn.Config
* Wait for connection to complete by pinging the remote router
* Do some work
* Automatically disconnect with a similar command to the above
However when the script is executed under the auspices of the Task Scheduler, run with administrator privileges and "Run with Highest Privileges" checked (as noted in other forum entries), OpenVPN-gui.exe enters the following in the Event>Windows Logs>Application log:
In other forum entries it was suggested that the OpenVPN service be changed from Manual to Automatic, which I have done.The description for Event ID 0 from source OpenVPN GUI cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Previous instance not yet ready to accept commands. Try again later.
Ideas as to what I haven't tried to get OpenVPN-gui to cooperate when run as a scheduled task?