0%
Create a New User Account

Create a New User Account

This guide shows you how to create a new user account in Active Directory using PowerShell.

10-15 min

Creating User Accounts in Active Directory with PowerShell

This guide explains how to create user accounts in Active Directory (AD) using PowerShell with various configuration options, such as the password, account expiration, and organizational unit (OU). This lets you automate account management and configure users with specific settings.


Prerequisite: Set a Secure Password for Users

To create a user account with PowerShell, you often need to set an initial password securely. The ConvertTo-SecureString cmdlet converts a password into a secure format.

# Définit un mot de passe sécurisé pour les utilisateurs
$MDP = ConvertTo-SecureString -AsPlainText "P@$$word" -Force
  • Purpose: Convert the password into a secure string to protect sensitive information.
  • Explanation:
    • ConvertTo-SecureString: Converts plain text into a secure password format for use in Active Directory.
    • -AsPlainText "P@$$word": Specifies the password in plain text (only in a secure environment).
    • -Force: Forces the conversion to a secure password even though the text is in plain text.
Link copied!