UserLock Documentation
UserLock Documentation
You are here: Reference > UserLock PowerShell > Cmdlet Help > Remove-UserLockProtectedAccount

Remove-UserLockProtectedAccount Cmdlet

Synopsis

Deletes protected accounts.

Syntax

Remove-UserLockProtectedAccount [-Name] <string[]> [-Type <ProtectedAccountType[]>] [-StartDate <DateTime>] [-EndDate <DateTime>] [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]

Remove-UserLockProtectedAccount [-InputObject] <ProtectedAccount[]> [-Type <ProtectedAccountType[]>] [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]

Description

The Remove-UserLockProtectedAccount cmdlet deletes one or several protected accounts. Without parameters, Remove-UserLockProtectedAccount removes no protected account. You can also specify a particular protected account by its account name, specify a particular account type (user, group or OU) or remove 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 to delete. Wildcard characters are permited. 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 one or more protected accounts types. 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

-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 delete. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe the objects to Remove-UserLockProtectedAccount.

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 deleted 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>

Deletes 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 Remove-UserLockProtectedAccount by its alias, "rulpa". For more information, see about_Aliases. To use Remove-UserLockProtectedAccount, you must have the "Protected account" UserLock administrative access right. Remove-UserLockProtectedAccount prompts to confirm creation by default. To prevent from prompting, use -Force.

Examples

Example 1

C:\PS>Remove-UserLockProtectedAccount * -Type User -UserLockServerName 'MyUlSrv'

Deletes all user protected accounts through the 'MyUlSrv' UserLock server.

Example 2

C:\PS>Get-UserLockProtectedAccount -Name 'Alice', 'Bob' -UserLockServerName 'MyUlSrv' | Remove-UserLockProtectedAccount -UserLockServerName 'MyUlSrv'

Gets the 'Alice' and 'Bob' user protected accounts through the 'MyUlSrv' UserLock server then deletes those protected accounts.

Example 3

C:\PS>$pas = Get-UserLockProtectedAccount -Name 'Alice', 'Bob' -UserLockServerName 'MyUlSrv' C:\PS>Remove-UserLockProtectedAccount -InputObject $pas -UserLockServerName 'MyUlSrv'

Gets the 'Alice' and 'Bob' user protected accounts through the 'MyUlSrv' UserLock server then deletes those protected accounts.

Example 4

C:\PS>[DateTime]$StartDate = '2014-06-01 00:00:00' C:\PS>[DateTime]$EndDate = '2014-07-01 00:00:00' C:\PS>nulpa MyUser -StartDate $StartDate -EndDate $EndDate -Force C:\PS>$Id = gulpa MyUser -StartDate $StartDate -EndDate $EndDate -Property Identifier C:\PS>rulpa $Id C:\PS>nulpa MyUser -StartDate $StartDate -EndDate $EndDate -Force C:\PS>rulpa MyUser -StartDate $StartDate -EndDate $EndDate -Force

Creates a temporary protected account, then gets its ID, removes it through its ID. Then creates it again and removes it through its name and dates.

Related Links

Get-UserLockProtectedAccount

New-UserLockProtectedAccount

Get-UserLockCommand