Active Directory

Method1:

Create a user by executing the following PowerShell Script.

New-ADUser -name 'Michael Jordan' -SamAccountName jordan.michael -UserPrincipalName jordan.michael@pandabusiness.local -Path "OU=Users,OU=Administration,DC=pandabusiness,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText 'Password123' -force) -Enabled $true -ChangePasswordAtLogon $true

Method2:

Creating a large number of users via CSV file.

Name,First Name,Last Name,Email,Sam,OU
Geddy Lee,Geddy,Lee,lee.geddy@pandabusiness.local,lee.geddy,"OU=Users,OU=Sales,DC=pandabusiness,DC=local"
Neil Peart,Neil,Peart,peart.neil@pandabusiness.local,peart.neil,"OU=Users,OU=Administration,DC=pandabusiness,DC=local"
Alex Lifeson,Alex,Lifeson,lifeson.alex@pandabusiness.local,lifeson.alex,"OU=Users,OU=Sales,DC=pandabusiness,DC=local"
Norah Jones,Norah,Jones,jones.norah@pandabusiness.local,jones.norah,"OU=Users,OU=Administration,DC=pandabusiness,DC=local"
Sarah Vaughan,Sarah,Vaughan,vaughan.sarah@pandabusiness.local,vaugan.sarah,"OU=Users,OU=Sales,DC=pandabusiness,DC=local"
Billie Holiday,Billie,Holiday,holiday.billie@pandabusiness.local,holiday.billie,"OU=Users,OU=Administration,DC=pandabusiness,DC=local"
Ella Fitzgerald,Ella,Fitzgerald,fitzgerald.ella@pandabusiness.local,fitzgerald.ella,"OU=Users,OU=Sales,DC=pandabusiness,DC=local"
Anita Oday,Anita,Oday,oday.anita@pandabusiness.local,oday.anita,"OU=Users,OU=Administration,DC=pandabusiness,DC=local"
John BonJovi,John,BonJovi,bonjovi.john@pandabusiness.local,bonjovi.john,"OU=Users,OU=Sales,DC=pandabusiness,DC=local"

Import the user the users by executing the following PowerShell Script.

Import-Csv -Path C:UserAd.csv | ForEach-Object {New-ADUser -name $_.name -DisplayName $_.name -SamAccountName $_.sam -UserPrincipalName $_.email -Path $_.ou -AccountPassword (ConvertTo-SecureString -AsPlainText 'Senha123' -force) -Enabled $true -ChangePasswordAtLogon $true}

More Information
=================

https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-aduser

相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。
原文地址:https://www.cnblogs.com/keepmoving1113/p/12242738.html