Import user-specific data from a Excel-sheet into Active Directory

I want to import data from a Excel-sheet (department, job title, address, phone etc.) to available AD-users by command or any free tool.
example: I have created users already, I want take Employee ID (login id) as reference since it is unique and then related to that employee id, other details need to be imported. now only we have only login id, Name, first name, lost name, display name, only. kindly explain how to import the user data.
nivasnetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
PowerShell, VBA in Excel, VBScript are coming into mind immediately. PowerShell and a CSV file are best.
0
nivasnetAuthor Commented:
could you explain the command or script.
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Have been answering on tablet, so didn't want to type a code snippet ;-).
Here is some PowerShell code, reading in a CSV file with headers, and fields as "Login ID", "Department", "Job Title":
Import-Module ActiveDirectory
Import-CSV 'C:\temp\ADUsers.csv' | % {
  Set-ADUser $_."Login ID" -Department $_.Department -Title $_."Job Title"
}

Open in new window

The values you can set with Set-ADUser are enumerated and explained at https://technet.microsoft.com/de-de/library/ee617215.aspx . If the CSV field names contain spaces, you have to enclose them in single or double quotes (or curly braces) when using, as shown above.
0
Dhaval PandyaExchange AdministratorCommented:
Hi,

You can use below script and CSV file format to import data. Pls ensure that the path is correct for CSV file as per script, you have to provide SAMAccountName in script to change data for.

If you provide which data you want to import then i can provide better script.

Hope this will help.



=============Strat of Script ================

#path to import CSV file with user's details.
$importfile = "C:\script\Domain\DomainUser.csv"

#import use's details from each line
$importedusers = Import-CSV $importfile

#Running for loop to set imported data for each user
foreach ($importeduser in $importedusers)
    {
Set-ADUser $importeduser.SAM -Name $importeduser.Name  -GivenName $importeduser.Gname -Surname $importeduser.Sname -DisplayName $importeduser.NAME -City $importeduser.City -Company $importeduser.org -Department $importeduser.Department -Title $importeduser.Title -manager $importeduser.manager

start-sleep -s 2
Get-aduser $importeduser.SAM -Property * | select SAMAccountName, Givenname, Surname, DisplayNAME, City, Compaly, Department, Title, manager

    }
============End of Script=========

=========DomainUser.CSV File Content===========
#Heading of CSV File
SAM, Gname, Sname, NAME, City, org, Department, Title, manager
#sample data of CSV File
Jack.R, Jack, Ramov, Jack Ramov, newcity, mycompany, Sales, Executive, ReportingmanagerName

===============end of DomainUser.CSV File ===========
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.