Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Created June 5, 2017 13:36
Show Gist options
  • Save g3rhard/a92f6a053ce6d2fde0e82d813c291c88 to your computer and use it in GitHub Desktop.
Save g3rhard/a92f6a053ce6d2fde0e82d813c291c88 to your computer and use it in GitHub Desktop.
Добавление пользователей Active Directory средствами PowerShell
Import-CSV -delimiter "," c:\Temp\users.csv | foreach {
New-ADUser -SamAccountName $_.SamAccountName -GivenName $_.GivenName -Surname $_.Surname -Name $_.Name `
-Path "DC=domain,DC=local" `
-AccountPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled $true -PasswordNeverExpires $true -Description $_.description -DisplayName $_.DisplayName -userPrincipalName $_.userPrincipalName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment