Show pagesourceOld revisionsBacklinksExport to PDFBack to top Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer Reddit TeamsRecent ChangesSend via e-MailPrintPermalink × Table of Contents Bulk create users with PowerShell from csv source The script Discussion Sample CSV file Bulk create users with PowerShell from csv source The script Import-Csv -path NewAdUserFromExcel.csv | foreach { # -WhatIf New-AdUser -name $_.Name -GivenName $_.GivenName -Surname $_.SurName -SamAccountName $_.SamAccountName -UserPrincipalName $_.UserPrincipalName -OtherAttributes @{'mail'=$_.Mail} -Accountpassword (ConvertTo-SecureString -String $_.Password -AsPlainText -Force) -Enabled $true -path $_.Path -Company $_.Company Add-ADGroupMember -Identity "VPN Access group" -Members $_.SamAccountName Add-ADGroupMember -Identity "GitAccess" -Members $_.SamAccountName Set-ADUser -Identity $_.SamAccountName -PasswordNeverExpires $true } Sample CSV file Name,GivenName,Surname,SamAccountName,UserPrincipalName,Mail,Path,Password,Company John Smith,John,Smith,jsmith,jsmith@example.com,sohn.smith@example.com,"OU=Department,OU=Users,DC=example,DC=com",c0mpl3xp4$$w0rd,Department Discussion Real name: E-Mail: Enter your comment: Please solve the following equation to prove you're human. 200 -4 = Please keep this field empty: Subscribe to comments windows/scripting/bulk_create_users_with_powershell_from_csv_source.txt Last modified: 2023/11/02 10:33by tplecko
Discussion