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.



PowerShell, VBA in Excel, VBScript are coming into mind immediately. PowerShell and a CSV file are best.



PowerShell, VBA in Excel, VBScript are coming into mind immediately. PowerShell and a CSV file are best.



could you explain the command or script.



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":



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:scriptDomainDomainUser.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 ===========



Share this

Related Posts

There was an error in this gadget