> For the complete documentation index, see [llms.txt](https://tools.thehacker.recipes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tools.thehacker.recipes/mimikatz/modules/ts/sessions.md).

# sessions

`ts::sessions` can be used to list the current RDP sessions. It comes in handy for RDP hijacking.

Upon executing `ts::sessions` the following users are identified to be connected over RDP:

* `hacklab\m3g9tr0n` (Session: 3 - RDP-Tcp#4)
* `hacklab\Administrator` (Session: \*4 - RDP-Tcp#5)

```
mimikatz # ts::sessions

Session: 0 - Services
  state: Disconnected (4)
  user :  @
  curr : 9/25/2021 12:41:44 PM
  lock : no

Session: 2 - Console
  state: Connected (1)
  user :  @
  Conn : 9/25/2021 10:45:54 AM
  curr : 9/25/2021 12:41:44 PM
  lock : no

Session: 3 - RDP-Tcp#4
  state: Active (0)
  user : m3g9tr0n @ hacklab
  Conn : 9/25/2021 12:39:48 PM
  disc : 9/25/2021 12:39:48 PM
  logon: 9/25/2021 11:46:55 AM
  last : 9/25/2021 12:40:45 PM
  curr : 9/25/2021 12:41:44 PM
  lock : no
  addr4: 192.168.0.92

Session: *4 - RDP-Tcp#5
  state: Active (0)
  user : administrator @ hacklab
  Conn : 9/25/2021 12:39:49 PM
  disc : 9/25/2021 12:39:49 PM
  logon: 9/25/2021 12:32:36 PM
  last : 9/25/2021 12:41:44 PM
  curr : 9/25/2021 12:41:44 PM
  lock : no
  addr4: 192.168.0.92

Session: 65536 - RDP-Tcp
  state: Listen (6)
  user :  @
  lock : no
```

{% hint style="info" %}
The asterisk on the `Session: *4 - RDP-Tcp#5`\*\* \*\*indicates the user via whom the `ts::sessions` is executed.
{% endhint %}

Another interesting thing to pay attention is the **lock** field (It can be leveraged for RDP lateral movement). When a user has his/her monitor locked, then the following will be displayed:

```
mimikatz # ts::sessions

Session: 3 - RDP-Tcp#4
  state: Active (0)
  user : m3g9tr0n @ hacklab
  Conn : 9/25/2021 12:39:48 PM
  disc : 9/25/2021 12:39:48 PM
  logon: 9/25/2021 11:46:55 AM
  last : 9/25/2021 1:44:53 PM
  curr : 9/25/2021 1:44:57 PM
  lock : yes
  addr4: 192.168.0.92
```

*(Demonstration target is a Windows Server 2016 Essentials)*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tools.thehacker.recipes/mimikatz/modules/ts/sessions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
