---
locale: "en"
updated_at: "2025-10-27T19:57:04.826Z"
canonical: "https://www.isdecisions.com/en/userlock/docs/build-with-userlock/powershell/cmdlet-reference/new-userlockprotectedaccount"
---

# New-UserLockProtectedAccount

## Synopsis

Creates a protected account.

## Syntax

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

New-UserLockProtectedAccount [-InputObject] <ProtectedAccount[]> [-UserLockServerName <string>] [-PassThru] [-Force] [-Confirm] [-WhatIf][<CommonParameters>]
```

## Description

The New-UserLockProtectedAccount cmdlet creates one or several protected accounts. Without parameters, New-UserLockProtectedAccount will create no protected account. You can specify a particular protected account by its account name, specify a particular account type (user, group or OU) or create temporary protected accounts specifying dates of such protected accounts. Caution: PowerShell 3.0 is required.

## Parameters

#### -Name <string[]>

Specifies the name of the account for which to create a protected account. You can type multiple account names (separated by commas). For a temporary name, either enter its account name and specify StartDate and EndDate parameters, or enter here its identifier. The syntax for this parameter is [Domain\]Account. If the cmdlet is run from a DC, there is no need to specify the domain name: UserLock will try to create the protected account from the concerned domain account. If the cmdlet is run from a non DC computer and no domain name is specified, then UserLock will try to create the protected account from the concerned local account of the local computer.

|  |  |
| --- | --- |
| Required | false |
| Position | 1 |
| Accepts pipeline input | true (ByValue, ByPropertyName) |
| Accepts wildcard characters | true |

#### -Type <ProtectedAccountType>

Type of the account(s) to create. Possible values for this parameter include: User or 1 Group or 2 Ou or 3 The default protected account type is User.

|  |  |
| --- | --- |
| Required | false |
| Position | named |
| Accepts pipeline input | false |
| Accepts wildcard characters | false |
| Default Value | User |

#### -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 the protected accounts objects that represent protected accounts to be created. Enter a variable that contains the protected account objects or a cmdlet that gets the protected accounts objects, such as the [Get-UserLockProtectedAccount](/userlock/docs/build-with-userlock/powershell/cmdlet-reference/get-userlockprotectedaccount#get-userlockprotectedaccount) one. You can also pipe the objects to New-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 created 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>

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

## Examples

#### Example 1

```powershell
New-UserLockProtectedAccount -Name 'Alice', 'Bob' -UserLockServerName 'MyUlSrv'
```

Creates the 'Alice' and 'Bob' user protected accounts through the 'MyUlSrv' UserLock server.

#### Example 2

```powershell
$pas = gulpa -UserLockServerName 'MyUlSrv1'
nulpa -UserLockServerName 'MyUlSrv2' -Inp $pas
```

Gets all protected accounts from the 'MyUlSrv1' UserLock server then creates the same protected accounts in the 'MyUlSrv2' UserLock server.

#### Example 3

```powershell
[DateTime]$StartDate = '2014-06-01 00:00:00'
[DateTime]$EndDate = '2014-07-01 00:00:00'
nulpa MyUser -StartDate $StartDate -EndDate $EndDate -Force
```

Creates a temporary protected account specifying its start and end dates.

## Related Links

[Get-UserLockProtectedAccount](/userlock/docs/build-with-userlock/userlock-powershell/cmdlet-help/get-userlockprotectedaccount)

[Set-UserLockProtectedAccount](/userlock/docs/build-with-userlock/userlock-powershell/cmdlet-help/set-userlockprotectedaccount)

[Get-UserLockCommand](/userlock/docs/build-with-userlock/userlock-powershell/cmdlet-help/get-userlockcommand)
