I need this workflow in a larger script in case an error occurs, such as the loss of a licence, and I need to set up a new connection automatically at a later time ...