Terminal session disconnection and share the session to other xaml

Hi All,

I am connecting the terminal session using direct connection type method, In this i am unable to disconnect the terminal session for retrying. Unable to pass the session to another task or xaml. please help me how to do disconnect the terminal session?

To disconnect a terminal session in UiPath, you can use the “Disconnect Terminal Session” activity. This activity allows you to disconnect the current terminal session, which you can then use to retry or pass the session to another task or XAML.

Here’s how to use the “Disconnect Terminal Session” activity:

  1. Add the “Disconnect Terminal Session” activity to your workflow where you want to disconnect the session.
  2. In the “Session” field, select the session that you want to disconnect. You can use a variable or an expression to specify the session.
  3. If you want to wait for the session to disconnect before continuing with the workflow, select the “Wait for session to disconnect” option.
  4. Click “Save & Exit” to save the activity.

Once you have added the “Disconnect Terminal Session” activity, you can use it to disconnect the session and then retry or pass the session to another task or XAML.

Thanks for your reply!

i am unable to view any option like “Disconnect Terminal Session” activity in UiPath studio. Please find the image .

Hi @suresh_ch
Please open Terminal session activity and go to activity properties.


If it doesn’t work then unfortunately you have only one option to use kill process activity.

Happy Automation

Thank you for your reply Raja !

Actually what happen here, i used the terminal connection type as direct connection so while running the code the UiPath itself opens the terminal in executor window due to this unable kill the process , disconnect the session and share the session to another xaml .

Please find the below screen shot connection type what i used.

Use same activity once more time and enable close connection in property section.


yes i used it but not working.

Please read this one

The above logic is not working and didn’t close the current session. it’s causing the error like terminal session is not exist.

Hi @suresh_ch,

  1. The session variable is not being passed correctly to the “Disconnect Terminal Session” activity. Double-check that the session variable being passed to the activity is the same variable that was used to establish the terminal session.
  2. The session might have already been closed or disconnected by another activity or process. In this case, you can use a Try-Catch block around the “Disconnect Terminal Session” activity to catch the error and ignore it. This will prevent the error from stopping the execution of your workflow.


  1. I have given the correct variables and mapped properly still having same issue.
  2. As you mentioned in 2 point , i have given terminal disconnect code inside the try block only. Actually I have kept the entire code inside the times loop . For every retry the bot is creating new session and didn’t disconnect the existing session.

@suresh_ch - I am having the same issue as you. The terminal session connection is being variablized and passed to a new terminal session activity.

Within that activity, I have checked the “Close Connection” property and passed the existing connection but it is not closing.

I feel like this used to work…