Update AutoUserCreator.ps1
This commit is contained in:
parent
a77162135c
commit
d52fb7f4e9
|
@ -9,9 +9,6 @@ Import-Module ActiveDirectory
|
||||||
# Define temporary password which MUST be changed when the user first logs into the Active Directory.
|
# Define temporary password which MUST be changed when the user first logs into the Active Directory.
|
||||||
$SecurePass = ConvertTo-SecureString -AsPlainText "Mypassword1" -Force
|
$SecurePass = ConvertTo-SecureString -AsPlainText "Mypassword1" -Force
|
||||||
|
|
||||||
# Force user to change password when logging on for the first time
|
|
||||||
ChangePasswordAtLogon = $true
|
|
||||||
|
|
||||||
# Define the file path where the CSV file containing users is.
|
# Define the file path where the CSV file containing users is.
|
||||||
$csvfilepath = Read-Host - Prompt "Please enter the location of the CSV file containing the user list"
|
$csvfilepath = Read-Host - Prompt "Please enter the location of the CSV file containing the user list"
|
||||||
|
|
||||||
|
@ -20,7 +17,7 @@ ForEach ($user in $users) {
|
||||||
$fname = $user.'First Name’
|
$fname = $user.'First Name’
|
||||||
$lname = $user.'Last Name'
|
$lname = $user.'Last Name'
|
||||||
$jtitle = $user.'Job Title'
|
$jtitle = $user.'Job Title'
|
||||||
$OUpath = $user.'Organizational Unit'
|
$OUpath = $user.'Organizational Unit' #Example entry: OU=Staff,OU=Manager,DC=alphadelta,DC=com
|
||||||
|
|
||||||
# Command to add user's to Active Directory.
|
# Command to add user's to Active Directory.
|
||||||
New-ADUser -Name $fname -UserPrincipalName "$fname.$lname"
|
New-ADUser -Name $fname -UserPrincipalName "$fname.$lname"
|
||||||
|
|
Loading…
Reference in New Issue