Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Users = Import-Csv -Path "C:\Users\Administrator\Desktop\Companydata.csv"
- foreach ($User in $Users)
- {
- $UserFirstname = $User.'Firstname'
- $UserLastname = $User.'Lastname'
- $UserDepartment = $User.'Department'
- $UserPosition = $User.'Position'
- $UserPhoneNumber = $User.'PhoneNumber'
- $UserCityandState = $User.'CityandState'
- $UserEmailAddress = $User.'EmailAddress'
- $OU = $User.'Users'
- $SAM = $User.'SAM'
- $UPN = $User.'Firstname' + "." + $User.'Lastname' + "@" + $User.'Maildomain'
- $Description = $User.'Description'
- $Password = $User.'Password'
- New-ADUser -FirstName $_.FirstName -LastName $_.LastName -Department $_.Department -Position $_.Position -PhoneNumber $_.PhoneNumber -CityandState $_.CityandState -EmailAddress $_.EmailAddress -BLANK $_.BLANK -Enabled $true -Path "$OU"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement