Set-UserLockProtectedAccount Cmdlet
Synopsis
Sets the configuration of a protected account.
Syntax
Set-UserLockProtectedAccount [-Name] <string[]> [-Type <ProtectedAccountType[]>] [-Property] <string> [-Value] <string> [-StartDate <DateTime>] [-EndDate <DateTime>] [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-UserLockProtectedAccount [-InputObject] <ProtectedAccount[]> [-Type <ProtectedAccountType[]>] [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]
Description
The Set-UserLockProtectedAccount cmdlet sets the configuration of one or several protected accounts. Without parameters, Set-UserLockProtectedAccount sets no protected account. You can specify a particular protected account by its account name, specify a particular account type (user, group or OU) or set only temporary protected accounts filtering on dates of such protected accounts. Caution: PowerShell 3.0 is required.
Parameters
-Name <string[]>
Specifies the name of the protected account(s) for which to set the configuration. Wildcards characters are permitted. 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. For a temporary name, either enter its account name and specify StartDate and EndDate parameters, or enter here its identifier.
Required | true |
Position | 1 |
Accepts pipeline input | true (ByValue, ByPropertyName) |
Accepts wildcard characters | true |
-Type <ProtectedAccountType[]>
Specifies the type of the protected account(s) for which to set the configuration. The parameter name ("Type") is optional. Possible values for this parameter include: User or 1 Group or 2 Ou or 3 To specify multiple protected account types, use a comma-separated list. The default protected account type is User,Group,Ou.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
Default Value | User,Group,Ou |
-Property <string>
Specifies the name of the property to modify.
Required | true |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-Value <string>
Specifies the new value of the property.
Required | true |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-StartDate <DateTime>
Specifies the start date of temporary protected account(s). This parameter is optional.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-EndDate <DateTime>
Specifies the end date of temporary protected account(s). This parameter is optional.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-InputObject <ProtectedAccount[]>
Specifies ProtectedAccount objects representing the protected accounts to set the configuration. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe the objects to
Required | true |
Position | named |
Accepts pipeline input | true (ByValue) |
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 | '.' |
-PassThru <SwitchParameter>
Returns the concerned protected account object(s). By default, this cmdlet does not generate any output.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-Force <SwitchParameter>
Sets the configuration of the protected account(s) with no confirmation.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-Confirm <SwitchParameter>
Prompts you for confirmation before executing the command.
Required | false |
Position | named |
Accepts pipeline input | false |
Accepts wildcard characters | false |
-WhatIf <SwitchParameter>
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 |
<CommonParameters>
For more information about common parameters, type "Get-Help about_commonparameters".
Input Type
ISDecisions.UserLockLibrary.ProtectedAccount, ISDecisions.UserLockLibrary.PaTmp
Return Type
None, ISDecisions.UserLockLibrary.ProtectedAccount, ISDecisions.UserLockLibrary.PaTmp
Notes
You can also refer to Set-UserLockProtectedAccount by its alias, "sulpa". For more information, see about_Aliases. To use Set-UserLockProtectedAccount, you must have the "Protected account" UserLock administrative access right. Set-UserLockProtectedAccount prompts to confirm modification of the configuration by default. To prevent from prompting, use -Force.
Examples
Example 1
Set-UserLockProtectedAccount -Name Alice, Bob -UserLockServerName MyUlSrv -Property NbConcurrentLogins -Value 1
Sets to 1 the 'Total allowed interactive sessions' property for the 'Alice' and 'Bob' user protected accounts through the 'MyUlSrv' UserLock server.
Example 2
Set-UserLockProtectedAccount -Type User,Group -Property DisplayWelcomeMessage -Value True
Enable the welcome message for all User and Group protected accounts of the localhost UserLock server.
Example 3
[DateTime]$StartDate = (Get-Date).Date.AddHours(9)
[DateTime]$EndDate = (Get-Date).Date.AddDays(7).AddHours(19)
$newUlPa = New-UserLockProtectedAccount -Name MyUser -StartDate $StartDate -EndDate $EndDate -Force -PassThru
$Id = $newUlPa.Identifier
Set-UserLockProtectedAccount -Name $Id -Property NbConcurrentLogins -Value 1 -Force
Set-UserLockProtectedAccount -Name $Id -Property ExceptWorkstationsNew -Value 0 -Force
Set-UserLockProtectedAccount -Name $Id -Property Computers -Value "WORKSTATION1`nWORKSTATION2`nWORKSTATION9" -Force
Creates a temporary protected account between the current day at 9:00 am and 7 days later at 7:00 pm, by obtaining the created object (due to the PassThru switch parameter), retrieves the ID of this object, sets the maximum number of interactive sessions at 1, and allows Interactive sessions only from WORKSTATION1, WORKSTATION2, and WORKSTATION9.