Forum Discussion
Marvin Oco
Jan 11, 2021Steel Contributor
script on how to update AD user info data from csv file
any script on how to update AD user info data from csv file? UPN First Name Middle Name Last Name Title Department Company anna@contoso.com Anna Santos Luna Vice Chairman Office ...
Marvin Oco
Jan 11, 2021Steel Contributor
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"
_-----------------------------
Dave Patrick
Jan 12, 2021MVP
You can ask for help writing PowerShell scripts over here in dedicated forum.
windows-server-powershell - Microsoft Q&A