As mentioned several times in this book, https://www.spiceworks.com/ has a busy PowerShell support forum (accessible at https://community.spiceworks.com/programming/powershell). A frequently asked (and answered) question is: How do I add multiple users using an input file? This recipe does just that. You start with a simple CSV file containing the details of the users you wish to add. This script uses a CSV file and adds the users contained in the CSV.
This recipe assumes you have a domain setup and that you have created the IT organizational unit.
- Import a CSV file containing the details of the users you want to add to AD:
$Users = Import-CSV -Path C:\FooUsers.Csv
- Add the users using the CSV:
ForEach ($User in $Users) { $Prop = @{} $Prop.GivenName = $User.Firstname $Prop.Initials = $User.Initials $Prop.Surname = $User.Lastname $Prop.UserPrincipalName = $User.UserPrincipalName+"@reskit.org" $Prop.Displayname = $User.firstname...