script on how to update AD user info data from csv file

%3CLINGO-SUB%20id%3D%22lingo-sub-2051524%22%20slang%3D%22en-US%22%3Escript%20on%20how%20to%20update%20AD%20user%20info%20data%20from%20csv%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2051524%22%20slang%3D%22en-US%22%3E%3CP%3Eany%20script%20on%20how%20to%20update%20AD%20user%20info%20data%20from%20csv%20file%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20width%3D%22802%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22131%22%3EUPN%3C%2FTD%3E%3CTD%20width%3D%2274%22%3EFirst%20Name%3C%2FTD%3E%3CTD%20width%3D%2292%22%3EMiddle%20Name%3C%2FTD%3E%3CTD%20width%3D%2271%22%3ELast%20Name%3C%2FTD%3E%3CTD%20width%3D%2297%22%3ETitle%3C%2FTD%3E%3CTD%20width%3D%22242%22%3EDepartment%3C%2FTD%3E%3CTD%20width%3D%2295%22%3ECompany%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CA%20href%3D%22mailto%3Aanna%40contoso.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eanna%40contoso.com%3C%2FA%3E%3C%2FTD%3E%3CTD%3EAnna%3C%2FTD%3E%3CTD%3ESantos%3C%2FTD%3E%3CTD%3ELuna%3C%2FTD%3E%3CTD%3EVice%20Chairman%3C%2FTD%3E%3CTD%3EOffice%20of%20the%20Chairman%20and%20President%3C%2FTD%3E%3CTD%3EContoso%20Corp.%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CA%20href%3D%22mailto%3Ajoy%40contoso.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ejoy%40contoso.com%3C%2FA%3E%3C%2FTD%3E%3CTD%3EJoy%3C%2FTD%3E%3CTD%3EVera%3C%2FTD%3E%3CTD%3EPerez%3C%2FTD%3E%3CTD%3EAssistant%3C%2FTD%3E%3CTD%3ELoans%20Processing%20Center%3C%2FTD%3E%3CTD%3EContoso%20Corp.%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2051524%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EActive%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2051542%22%20slang%3D%22en-US%22%3ERe%3A%20script%20on%20how%20to%20update%20AD%20user%20info%20data%20from%20csv%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2051542%22%20slang%3D%22en-US%22%3E%3CP%3EGive%20these%20ones%20of%26nbsp%3B%20Richard's%20a%20go.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.rlmueller.net%2Ffreecode4.htm%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EUser%20Administration%20(rlmueller.net)%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2051563%22%20slang%3D%22en-US%22%3ERe%3A%20script%20on%20how%20to%20update%20AD%20user%20info%20data%20from%20csv%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2051563%22%20slang%3D%22en-US%22%3E%3CP%3Ewill%20this%20work%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E____________________%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImport-Module%20ActiveDirectory%3CBR%20%2F%3E%24csv%20%3D%20Import-Csv%20c%3A%5Cusers%5Cuser%5CDesktop%5Cusers.csv%3CBR%20%2F%3Eforeach%20(%24line%20in%20%24csv)%20%7B%3CBR%20%2F%3E%24UserPrincipalName%20%3D%20%24line.UserPrincipalName%3CBR%20%2F%3EGet-ADUser%20-Filter%20%7BUserPrincipalName%20-eq%20%24UserPrincipalName%7D%20%7C%3CBR%20%2F%3ESet-ADUser%20-Title%20%24(%24csv.title)%20-Department%20%24(%24csv.Department)%20-Company%20%24(%24csv.company)%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EWrite-Host%20%22Done%20running%20Script%22%3C%2FP%3E%3CP%3ERead-Host%20-Prompt%20%22Press%20Enter%20to%20exit%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E_-----------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E
Super Contributor

any script on how to update AD user info data from csv file?

 

UPNFirst NameMiddle NameLast NameTitleDepartmentCompany
anna@contoso.comAnnaSantosLunaVice ChairmanOffice of the Chairman and PresidentContoso Corp.
joy@contoso.comJoyVeraPerezAssistantLoans Processing CenterContoso Corp.
3 Replies

Give these ones of  Richard's a go.

User Administration (rlmueller.net)

 

 

 

will this work?

 

 

____________________

 

 

Import-Module ActiveDirectory
$csv = Import-Csv c:\users\user\Desktop\users.csv
foreach ($line in $csv) {
$UserPrincipalName = $line.UserPrincipalName
Get-ADUser -Filter {UserPrincipalName -eq $UserPrincipalName} |
Set-ADUser -Title $($csv.title) -Department $($csv.Department) -Company $($csv.company)
}


Write-Host "Done running Script"

Read-Host -Prompt "Press Enter to exit"

 

 

_-----------------------------

You can ask for help writing PowerShell scripts over here in dedicated forum.

windows-server-powershell - Microsoft Q&A