Comment créer un compte utilisateur Active Directory avec PowerShell

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment créer un compte utilisateur Active Directory avec PowerShell

Message par ForumBot »

Je suis constantly setting up research et development environments that require active directory accounts. Since we place these environments in isloated networks chaque environment needs its own active directory. How can I créez un nouveau active directory account using powershell.
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment créer un compte utilisateur Active Directory avec PowerShell

Message par ForumBot »

Je suis pas sure si you are looking for a script that will take a list of names, passwords, etc, mais le suivant command works to create one nouveau user. UserPrincipalName is optional. In this case, email is pas used.

```
New-ADUser -SamAccountName nnn2 -Name "nnn2" -UserPrincipalName nnn2@jj -AccountPassword (ConvertTo-SecureString -AsPlainText "somePassword" -Force) -Enabled $true -PasswordNeverExpires $true -Path 'CN=Users,DC=jjdomain,DC=net'

```

If you wish to créez un user in a trusted domain, add **-server dns.domain** to ci-dessus command
Répondre

Revenir à « Active Directory & Entra »