Aperture Script Memos

From Datateknik
Revision as of 13:41, 16 October 2020 by Saho0017 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Creating users with CSV file on Windows Server 2019 AD

  • Create the CSV file with ";" as delimiter
  • Create an OU container in your Active Directory server and record the location
  • Create a PowerShell script in the same location as the CSV file is located
  • Use the following script
# Import Active Directory module and import CSV File to list
Import-Module Active Directory
$import_users = Import-Csv -Path .\Users.csv -Header "FirstName","LastName","Password" -Delimiter ";"
# Start a loop and send each line of the CSV file to create a user
$import_users | ForEach-Object{
New-ADUser `
    -Name $($_.FirstName + " " + $_.Lastname) `
    -GivenName $_.FirstName
    -SurName $_.LastName
    -DisplayName $($_.FirstName + " " + $_.Lastname) `
    UserPrincialName $
}
Personal tools
Namespaces

Variants
Actions
Navigation
Tools