Close-UserLockSession
Logs off session through the UserLock server.
Logs off session through the UserLock server.
Close-UserLockSession [-UserName] <string[]> [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]
Close-UserLockSession [-Name] <string[]> [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]
Close-UserLockSession [-ComputerName] <string[]> [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]
Close-UserLockSession [-InputObject] <Session[]> [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]The Close-UserLockSession cmdlet logs off interactive session(s) through the UserLock server. Caution: PowerShell 3.0 is required.
Specifies the name of the user for which to log off all sessions. You can type multiple user names (separated by commas). If the name includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. Wildcard characters are permitted.
Required | true |
Position | named |
Accepts pipeline input | true (ByValue, ByPropertyName) |
Accepts wildcard characters | true |
Specifies the name of the session (Universal key name, to uniquely identify it by specifying the type of session) to log off. You can type multiple session names (separated by commas). If the name includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. Wildcard characters are permitted.
Required | true |
Position | named |
Accepts pipeline input | true (ByValue, ByPropertyName) |
Accepts wildcard characters | true |
Specifies the name of the computer for which to log off all sessions. You can type multiple computer names (separated by commas). If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. Wildcard characters are permitted.
Required | true |
Position | named |
Accepts pipeline input | true (ByValue, ByPropertyName) |
Accepts wildcard characters | true |
Specifies the session objects that represent sessions to be logged off. Enter a variable that contains the session objects or a command that gets the session objects, such as a Get-UserLockSession command. You can also pipe the objects to Close-UserLockSession.
Required | true |
Position | named |
Accepts pipeline input | true (ByValue) |
Accepts wildcard characters | false |
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 | '.' |
Returns the logged off session object(s). By default, this cmdlet does not generate any output.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
Logs off session(s) with no confirmation.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
Prompts you for confirmation before executing the command.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
Describes what would happen if you executed the command without actually executing the command.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
For more information about common parameters, type "Get-Help about_commonparameters".
ISDecisions.UserLockLibrary.Session or ISDecisions.UserLockLibrary.UserSession
None or ISDecisions.UserLockLibrary.Session
You can also refer to Close-UserLockSession by its alias, "culs". For more information, see about_Aliases. To use Close-UserLockSession, you must have the "User sessions" UserLock administrative access right. Close RAS or IIS sessions is not supported. Close-UserLockSession prompts to confirm logoff by default. To prevent from prompting, use -Force. To use Close-UserLockSession with ISDecisions.UserLockLibrary.Session objects through the pipeline, you can use the Get-UserLockSession cmdlet.
Close-UserLockSession -UserName 'Alice', 'Bob' -UserLockServerName MyUlSrvLogs off all sessions of the 'Alice' and 'Bob' user accounts through the 'MyUlSrv' UserLock server.
Close-UserLockSession -ComputerName 'MyWrk01' -UserLockServerName MyUlSrvLogs off all sessions opened on the 'MyWrk01' computer through the 'MyUlSrv' UserLock server.
Close-UserLockSession -Name 'MyWrk01/0', 'MyWrk05/2' -UserLockServerName MyUlSrvLogs off 'MyWrk01/0' and 'MyWrk05/2' sessions through the 'MyUlSrv' UserLock server.
$us = Get-UserLockInteractiveSession | where {$PSItem.LogonDate -lt (Get-Date).Date.AddDays(-1)}
Close-UserLockSession -InputObject $us -ForceLogs off all interactive sessions with a logon date older than the previous day at midnight through the 'MyUlSrv' UserLock server.