Skip to content

Instantly share code, notes, and snippets.

@nshores
Created June 8, 2018 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nshores/a1452354449b5e9a805b0d4d08648f0e to your computer and use it in GitHub Desktop.
Save nshores/a1452354449b5e9a805b0d4d08648f0e to your computer and use it in GitHub Desktop.
new_ad_user.ps1
$content = Import-Csv 'c:\test.csv'
foreach ($user in $content){
New-ADUser -Enabled $True -AccountPassword (ConvertTo-SecureString aiwhc321 -AsPlainText -force) -name $user."Display Name" `
-homeDirectory $user."Home Directory" `
-homedrive $user."Home Drive" `
-scriptPath $user."Script Path" `
-SamAccountName $user."SAM Account Name" `
-path $user."OU Name"
#Path needs to be full LDAP DN path - "OU=students, DC=pel, DC=com"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment