# Get-Session

Returns one or more Sitecore user sessions using the specified criteria.

## Syntax

Get-Session \[-Identity \<AccountIdentity>]

Get-Session -InstanceId \<String\[]>

## Detailed Description

The Get-Session command returns one or more Sitecore user sessions using the specified criteria.

The Identity parameter specifies the Sitecore user to get. You can specify a user by its local name or fully qualified name.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

## Parameters

### -Identity \<AccountIdentity>

Specifies the Sitecore user by providing one of the following values.

```powershell
Local Name
    Example: admin
Fully Qualified Name
    Example: sitecore\admi
```

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -InstanceId \<String\[]>

Specifies the Sitecore SessionID.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

## Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

* None.

## Outputs

The output type is the type of the objects that the cmdlet emits.

* Sitecore.Web.Authentication.DomainAccessGuard.Session

  Returns one or more user sessions.

## Notes

Help Author: Adam Najmanowicz, Michael West

## Examples

### EXAMPLE 1

```powershell
PS master:\> Get-Session

Created                LastRequest            SessionID                  UserName
-------                -----------            ---------                  --------
7/3/2014 3:30:39 PM    7/3/2014 3:44:27 PM    tekipna1lk0ccr2z1bdjsua2   sitecore\admin
7/3/2014 4:13:55 PM    7/3/2014 4:13:55 PM    wq4bfivfm2tbgkgdccpyzczp   sitecore\michael
```

### EXAMPLE 2

```powershell
PS master:\> Get-Session -Identity admin

Created                LastRequest            SessionID                  UserName
-------                -----------            ---------                  --------
7/3/2014 3:30:39 PM    7/3/2014 3:44:27 PM    tekipna1lk0ccr2z1bdjsua2   sitecore\admin
```

### EXAMPLE 3

```powershell
PS master:\> Get-Session -InstanceId tekipna1lk0ccr2z1bdjsua2,wq4bfivfm2tbgkgdccpyzczp

Created                LastRequest            SessionID                  UserName
-------                -----------            ---------                  --------
7/3/2014 3:30:39 PM    7/3/2014 3:44:27 PM    tekipna1lk0ccr2z1bdjsua2   sitecore\admin
```

## Related Topics

* <https://github.com/SitecorePowerShell/Console/>
* [Remove-Session](/appendix/session/remove-session.md)


---

# Agent Instructions: 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:

```
GET https://doc.sitecorepowershell.com/appendix/session/get-session.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
