0

An organisation is using Active Directory Domain Services and Office 365 but with no synchronisation so there are a large number of discrepancies between the user accounts (different spellings of names, outdated job titles, wrong UPNs, etc).

The organisation is planning to migrate to a new AD DS, keep the same Office 365, and use synchronisation via Azure AD Connect (read: it's important that the user accounts are correct in the new AD domain).

I have exported the AD and AAD / O365 user accounts to CSVs and reconciled the discrepancies so now I need to import the CSV into AD but the semicolon-delimited proxyAddresses are proving to be a problem because it's importing the data as one value, rather than multiple.

I couldn't find a suitable resolution online, hence this post.

mythofechelon
  • 877
  • 3
  • 22
  • 38

1 Answers1

1

I created the following AD PowerShell command which worked great:

$Users = Import-Csv "<CSV_Path>\<CSV_FileName>.csv";

ForEach ($User in $Users){
    New-ADUser -Name $User."DisplayName" -DisplayName $User."DisplayName" -GivenName $User."GivenName" -Initials $User."Initials" -Surname $User."Surname" -Title $User."Title" -City $User."City" -Office $User."Office" -Department $User."Department" -OfficePhone $User."OfficePhone" -MobilePhone $User."MobilePhone" -SamAccountName $User."SamAccountName" -UserPrincipalName $User."UserPrincipalName" -EmailAddress $User."EmailAddress" -Path "<DN to OU>";

    ForEach ($ProxyAddress in ($User."ProxyAddresses" -Split ";")){
        Set-ADUser -Identity $User."SamAccountName" -Add @{ProxyAddresses=$ProxyAddress};
    }
}

Note regarding the parameters for the user account attributes: The strings enclosed in the parenthesis are the CSV column headers and are enclosed in parenthesis to handle potential spaces.

mythofechelon
  • 877
  • 3
  • 22
  • 38