Jan 11 2021 07:34 PM
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 of the Chairman and President | Contoso Corp. |
joy@contoso.com | Joy | Vera | Perez | Assistant | Loans Processing Center | Contoso Corp. |
Jan 11 2021 07:50 PM
Jan 11 2021 08:09 PM
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"
_-----------------------------
Jan 12 2021 08:44 AM
You can ask for help writing PowerShell scripts over here in dedicated forum.
windows-server-powershell - Microsoft Q&A