View FAQ

- Servers - Windows -


Powershell add users to Active Directory Windows Server 2012 ...
(posted by Steven A on 2015-08-14 13:42:39)

How to add users to Active Directory as a import from a csv file.


Solution:

    2008 Server Enable


    Features
    Add Feature
    - Windows Powershell Integrated Scripting Enviroment
    - Remote Server Admin Tools
    - Active Directory Modile for Windows Powerschell


    Active Directory Module for Windows Powerschell


    2012 enable


    Launch Powershell and put in the following command
    Set-ExecutionPolicy RemoteSigned


    Copy the excel csv file your are importing
    change to c:scripts


    c:scripts


    Import-Csv ./test.csv


    If it looks good then you will run this command


    Import-Csv ./test.csv | New-AdUser -Enable $True -AccountPassword (ConvertTo-SecureString ENTERPassword -AsPlainText -force) -City Wichita -State KS



    Import-Csv .userImport.csv | foreach-object {
    New-ADUser -Name $_.DisplayName -UserPrincipalName $_.UserPrincipalName -SamAccountName $_.Username -GivenName
    $_.GivenName -DisplayName $_.DisplayName -Initials $_.MiddleInitial -SurName $_.Surname -Description $_.Description
    -Department $_.Department -StreetAddress $_.StreetAddress -City $_.City -State $_.State -PostalCode $_.ZipCode -
    HomePhone $_.TelephoneNumber -Title $_.Occupation -Office $_.Office -Path $_.Path -AccountPassword (ConvertTo-
    SecureString $_.Password -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru }


Comments:

test.csv
(posted by Steven A on 2015-08-14 13:45:19)


© 2024 TkFast, Inc.  |  main  |  public  |  FAQs