TestimoX

API Reference

Command

New-ADXUser

Namespace ADPlayground.PowerShell
Outputs
ADPlayground.DirectoryMutationResult

Creates a new Active Directory user account.

Examples

Authored help example

Example 1: Preview a new helpdesk user in the managed users OU


New-ADXUser -SamAccountName 'marta.nowak' -OrganizationalUnit 'OU=Users,OU=Managed,DC=contoso,DC=com' -GivenName 'Marta' -Surname 'Nowak' -DisplayName 'Marta Nowak' -UserPrincipalName 'marta.nowak@contoso.com' -Mail 'marta.nowak@contoso.com' -Description 'Service Desk analyst - Krakow' -WhatIf
        

Example 2: Create a disabled service account with a staged password


$password = ConvertTo-SecureString 'S3rv1ce!2026' -AsPlainText -Force
            New-ADXUser -SamAccountName 'svc_sql_ops' -OrganizationalUnit 'OU=Service Accounts,OU=Tier1,DC=contoso,DC=com' -CommonName 'svc_sql_ops' -DisplayName 'SQL Operations Service' -Description 'Runs scheduled SQL maintenance jobs' -InitialPassword $password -Enabled $false
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

New-ADXUser -SamAccountName <string> -OrganizationalUnit <string> [-Attribute <Hashtable>] [-CommonName <string>] [-Description <string>] [-DisplayName <string>] [-Enabled] [-ExtensionAttribute <Hashtable>] [-GivenName <string>] [-InitialPassword <SecureString>] [-Mail <string>] [-Manager <string>] [-MustChangePasswordAtLogon] [-Surname <string>] [-UserPrincipalName <string>] [<CommonParameters>]
#

Parameters

SamAccountName string requiredposition: 0pipeline: false
Gets or sets the user sAMAccountName.
OrganizationalUnit string requiredposition: 1pipeline: false
Gets or sets the destination organizational unit distinguished name.
Attribute Hashtable optionalposition: namedpipeline: false
Gets or sets optional custom attributes to apply after creation.
CommonName string optionalposition: namedpipeline: false
Gets or sets optional common name (CN).
Description string optionalposition: namedpipeline: false
Gets or sets optional description.
DisplayName string optionalposition: namedpipeline: false
Gets or sets optional display name.
Enabled SwitchParameter optionalposition: namedpipeline: false
Gets or sets desired enabled state. Omit to keep default AD behavior.
ExtensionAttribute Hashtable optionalposition: namedpipeline: false
Gets or sets extension attributes to write. Keys accept numeric indexes (1-15) or extensionAttribute1-15.
GivenName string optionalposition: namedpipeline: false
Gets or sets optional given name.
InitialPassword SecureString optionalposition: namedpipeline: false
Gets or sets optional initial password.
Mail string optionalposition: namedpipeline: false
Gets or sets optional mail address.
Manager string optionalposition: namedpipeline: false
Gets or sets optional manager distinguished name.
MustChangePasswordAtLogon SwitchParameter optionalposition: namedpipeline: false
Gets or sets whether user must change password at next logon.
Surname string optionalposition: namedpipeline: false
Gets or sets optional surname.
UserPrincipalName string optionalposition: namedpipeline: false
Gets or sets optional user principal name (UPN).

Outputs

ADPlayground.DirectoryMutationResult