Get-UserLockSession

Gets the opened sessions registered in UserLock server.

Published May 31, 2025

Synopsis

Gets the opened sessions registered in UserLock server.

Syntax

powershell
Get-UserLockSession [-UserName <string[]>] [-SessionType <SessionType[]>] [-UserLockServerName <string>][<CommonParameters>]

Get-UserLockSession [-Name] <string[]> [-SessionType <SessionType[]>] [-UserLockServerName <string>][<CommonParameters>]

Get-UserLockSession [-ComputerName] <string[]> [-SessionType <SessionType[]>] [-UserLockServerName <string>][<CommonParameters>]

Description

The Get-UserLockSession cmdlet gets the opened sessions registered in UserLock server, and searches them by user name (name of the account that opened the session), by computer name (where the session is located) or by name of a session (Universal key name, to uniquely identify it by specifying the type of session). Also you can get specific types of sessions (Workstation, Terminal, Interactive, RAS and IIS). If the cmdlet is used without parameters, all sessions will be returned. Caution: PowerShell 3.0 is required.

Parameters

-UserName <string[]>

Specifies the user name of a session (name of the account that opened the session). You can type multiple user names (separated by commas). Wildcard characters are permitted.

Required

false

Position

1

Accepts pipeline input

true (ByValue, ByPropertyName)

Accepts wildcard characters

true

-Name <string[]>

Specifies the name of a session (Universal key name of the session, to uniquely identify it by specifying the type of session). You can type multiple names (separated by commas). Wildcard characters are permitted.

Required

true

Position

named

Accepts pipeline input

true (ByValue, ByPropertyName)

Accepts wildcard characters

true

-ComputerName <string[]>

Specifies the name of the computer where the session is located. You can type multiple computer names (separated by commas). Wildcard characters are permitted.

Required

true

Position

named

Accepts pipeline input

true (ByValue, ByPropertyName)

Accepts wildcard characters

true

-SessionType <SessionType[]>

Specifies the type of the session. You can type multiple session types (separated by commas). Possible values for this parameter include: Workstation or 1 Terminal or 2 Interactive or Workstation,Terminal or 3 IIS or 4 RAS or 8 All or Workstation,Terminal,Interactive,IIS,RAS or 15 The default session type is All. The alias for SessionType is Type.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

Default Value

Interactive

-UserLockServerName <string>

Specifies the name of the UserLock server. The default is the localhost name.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

Default Value

'.'

<CommonParameters>

For more information about common parameters, type "Get-Help about_commonparameters".

Input Type

None

Return Type

None, ISDecisions.UserLockLibrary.UserSession, ISDecisions.UserLockLibrary.RasSession or ISDecisions.UserLockLibrary.IisSession

Notes

You can also refer to Get-UserLockSession by its alias, "guls". For more information, see about_Aliases. To use Get-UserLockSession, you must have the "User sessions" UserLock administrative access right.

Examples

Example 1

powershell
Get-UserLockSession -UserLockServerName MyUlSrv

Gets all sessions registerered in the 'MyUlSrv' UserLock server.

Example 2

powershell
Get-UserLockSession Alice -Type Interactive,RAS -UserLockServerName MyUlSrv

Gets the interactive and RAS sessions, opened by the user Alice, registered in the 'MyUlSrv' UserLock server.

Get-UserLockInteractiveSession

Get-UserLockRasSession

Get-UserLockIisSession

Close-UserLockSession

Lock-UserLockSession

Reset-UserLockSession

Get-UserLockCommand