Advertisement
AndrewKaiser

Untitled

Apr 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Users = Import-Csv -Delimiter "," -Path "C:\tmp\test.csv"            
  2. foreach ($User in $Users)            
  3. {            
  4.     $Name = $User.Name        
  5.     $Path = $User.OU + "," + $User.BaseOU + "," + $User.DC
  6.     $City = $User.City          
  7.     $State = $User.State
  8.     $Company = $User.Company
  9.     $Department = $User.Department            
  10.     $Password = $User.Password  
  11.     $Description = $User.Description
  12.     $samAccountName = $User.samAccountName
  13.     $UserPrincipalName = $User.UserPrincipalName      
  14.     $DisplayName = $User.DisplayName
  15.     $GivenName = $User.GivenName
  16.     $Surname = $User.Surname    
  17.              
  18.     New-ADUser -Name "$Name" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$Path" -ChangePasswordAtLogon $false -CannotChangePassword $true –PasswordNeverExpires $true -server floridafamily.com  -City "$City" -Company "$Company" -Department "$Department" -State "$State" -GivenName "$GivenName" -Surname "$Surname" -UserPrincipalName "$UserPrincipalName" -DisplayName "$DisplayName"
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement