Test-UserLockSession

Tests a session and gets the answer from the UserLock server.

Published May 31, 2025

Synopsis

Tests a session and gets the answer from the UserLock server.

Syntax

powershell
Test-UserLockSession [-UserName <string[]>] [-UserLockServerName <string>] [-ComputerName <string>] [-ClientName <string>] [-ClientIps <string>] [-DateTime <string>] [-SessionType <SessionType>][<CommonParameters>]

Description

The Test-UserLockSession cmdlet tests a session for one or more user account names and gets the answer of the UserLock server. At least one user account name is required. The default session type is Workstation. Currently, only Workstation and Terminal session types are supported. Currently, only time frames are checked. Caution: PowerShell 3.0 is required.

Parameters

-UserName <string[]>

Specifies one or more user account names. You can type multiple user account names (separated by commas). Wildcard characters are managed only if the concerned user accounts did make at least one session event in UserLock (if they are displayed in the User sessions view). The parameter name ("UserName") is optional.

Required

true

Position

1

Accepts pipeline input

true (ByValue, ByPropertyName)

Accepts wildcard characters

false

-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

'.'

-ComputerName <string>

The computer name.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

-ClientName <string>

The client name.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

-ClientIps <string>

The client IP address(es).

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

-DateTime <string>

The date and time on which to make the test.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

-SessionType <SessionType>

Specifies the type of the session. You cannot type multiple session types. Possible values for this parameter are: Workstation or 1 Terminal or 2 IIS or 4 RAS or 8 The default session type is Workstation. The alias for SessionType is Type.

Required

false

Position

named

Accepts pipeline input

false

Accepts wildcard characters

false

<CommonParameters>

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

Input Type

None

Return Type

System.String

Notes

You can also refer to Test-UserLockSession by its alias, "tuls". For more information, see about_Aliases. To use Test-UserLockSession, no UserLock administrative access right is required.

Examples

Example 1

powershell
Test-UserLockSession -UserName 'Alice'

Tests a Workstation session with the 'Alice' user account and gets the answer of the localhost UserLock server.

Example 2

powershell
[DateTime]$dateTime = (Get-Date).AddDays(3)
Test-UserLockSession -UserName 'Bob' -ComputerName 'WORKSTATION1' -ClientName 'CLIENTCPU' -ClientIps '192.168.1.1' -DateTime $dateTime -SessionType 'Terminal' -UserLockServerName 'MyUlSrv'

Tests a Terminal session with the 'Bob' user account, the WORKSTATION1 computer, the CLIENTCPU client computer and the 192.168.1.1 client IP address, 3 days after the current date at the current time and gets the answer of the 'MyUlSrv' UserLock server.

Get-UserLockProtectedAccountEffective

Get-UserLockCommand