API Reference
Command
New-ADXUser
Creates a new Active Directory user account.
Examples
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
- Gets or sets the user sAMAccountName.
- OrganizationalUnit string
- Gets or sets the destination organizational unit distinguished name.
- Attribute Hashtable
- Gets or sets optional custom attributes to apply after creation.
- CommonName string
- Gets or sets optional common name (CN).
- Description string
- Gets or sets optional description.
- DisplayName string
- Gets or sets optional display name.
- Enabled SwitchParameter
- Gets or sets desired enabled state. Omit to keep default AD behavior.
- ExtensionAttribute Hashtable
- Gets or sets extension attributes to write. Keys accept numeric indexes (1-15) or extensionAttribute1-15.
- GivenName string
- Gets or sets optional given name.
- InitialPassword SecureString
- Gets or sets optional initial password.
- Mail string
- Gets or sets optional mail address.
- Manager string
- Gets or sets optional manager distinguished name.
- MustChangePasswordAtLogon SwitchParameter
- Gets or sets whether user must change password at next logon.
- Surname string
- Gets or sets optional surname.
- UserPrincipalName string
- Gets or sets optional user principal name (UPN).
Outputs
ADPlayground.DirectoryMutationResult