---
title: RDP and Copia Agents
description: Keeping Agents logged in over RDP
---

[Skip to content](https://help.copia.io/knowledge/rdp-and-copia-agents#main-content)

English

Show submenu for translations

[More support](https://help.copia.io/knowledge/kb-tickets/new?hsLang=en)

![](https://help.copia.io/hubfs/Logo_Hotdog_BlackWhite%20(1).svg)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [More support](https://help.copia.io/knowledge/kb-tickets/new)
- Contact us

 Contact us

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Copia Help Center](https://help.copia.io/knowledge?hsLang=en)
2. [DeviceLink FAQ](https://help.copia.io/knowledge/devicelink-faq?hsLang=en)
3. [Agent](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#agent)

# RDP and Copia Agents

## Keeping Agents logged in over RDP

#### **Problem**

Remote Desktop Protocol (RDP) is commonly utilized by organizations to access Agent PCs. However, by default, RDP leaves the Agent in a state where the screen is locked at the "logon" dialog.  This can cause issues with some integrations, as the Copia Agent may require the desktop session to remain unlocked, as discussed in the prior section.  

#### **Solutions**

To address the challenge of maintaining an unlocked Agent at customer sites, many strategies can be used, detailed below:

**1. Auto-Logon Configuration and Reboot Batch File**  
If the Agent PC is set up for auto-logon—*recommended due to potential IT updates requiring a PC reboot*—users can opt to reboot the PC instead of logging off.  A batch file can be placed on the remote Agent PC’s desktop (*or a shortcut to the batch file*) with the following command: 

```
shutdown -r -f -t 2
```

Here, **-r** denotes a reboot, **-f** forces the reboot, and **-t 2** initiates a countdown from 2 seconds. After completing operations, the user can execute this batch file (*or its shortcut*), which will disconnect the session, reboot the PC, and automatically log in, thereby restoring the PC to its original unlocked state.

**2. Batch File for Windows or Windows Server**  
For systems running Windows or Windows Server (*and potentially other operating systems with similar functionality*), a batch file can be placed on the remote Agent PC’s desktop (*or a shortcut to the batch file*). After completing operations, the user should run this batch file (*or its shortcut*) as an Administrator. This script will disconnect the session and redirect the PC back to the console session, maintaining the PC in its original unlocked state. Below are two examples of such batch files:

1. ```
   for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do ( %windir%\System32\tscon.exe %%s /dest:console )
   ```
   
    Save this script as a .BAT file and create a desktop shortcut to it. In the shortcut properties, select "Advanced" and choose "Run as Administrator."
2. ```
   tscon 1 /dest:console
   ```

 This command assumes that the RDP session is Session 1, which is typically the case unless multiple RDP sessions are active. To confirm the active Session ID, use the **qwinsta** command.

Save this script as a **.BAT** file and create a desktop shortcut to it. In the shortcut properties, select "Advanced" and choose "Run as Administrator."

- [Getting Started](https://help.copia.io/knowledge/getting-started?hsLang=en#main-content)

    - [Sales Wiki](https://help.copia.io/knowledge/getting-started?hsLang=en#sales-wiki)
    - [Account Management](https://help.copia.io/knowledge/getting-started?hsLang=en#account-management)
    - [Customer Experience](https://help.copia.io/knowledge/getting-started?hsLang=en#customer-experience)
- [Source Control FAQ](https://help.copia.io/knowledge/source-control-faq?hsLang=en#main-content)

    - [Web App](https://help.copia.io/knowledge/source-control-faq?hsLang=en#web-app)
    - [Git Questions](https://help.copia.io/knowledge/source-control-faq?hsLang=en#git-questions)
    - [Desktop App](https://help.copia.io/knowledge/source-control-faq?hsLang=en#desktop-app)
    - [Tutorials](https://help.copia.io/knowledge/source-control-faq?hsLang=en#tutorials)
    - [Best Practices](https://help.copia.io/knowledge/source-control-faq?hsLang=en#best-practices)
    - [Source Control](https://help.copia.io/knowledge/source-control-faq?hsLang=en#source-control)
- [DeviceLink FAQ](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#main-content)

    - [Siemens TIA Portal](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#siemens-tia-portal)
    - [Agent](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#agent)
    - [General](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#general)
    - [Rockwell Studio 5000](https://help.copia.io/knowledge/devicelink-faq?hsLang=en#rockwell-studio-5000)

[![Chill listening crop-3](https://help.copia.io/hs-fs/hubfs/Logo_Hotdog_BlackTeal-1.png?width=87&height=24&name=Logo_Hotdog_BlackTeal-1.png "Chill listening crop-3")](http://copia.io)

43 W 24th St, 6th Floor  
New York, NY 10010

<https://www.facebook.com/> <https://www.twitter.com/> <https://www.instagram.com/> <https://podcasts.apple.com/> [mailto:email@email.com](mailto:email@email.com)

Copyright © 2025, Copia Automation, Inc.