Active_Directory [SOLVED]: Import CSV of user accounts containing semicolon-delimited proxyAddresses

Active_Directory [SOLVED]: Import CSV of user accounts containing semicolon-delimited proxyAddresses

Home Forums Active Directory Active_Directory [SOLVED]: Import CSV of user accounts containing semicolon-delimited proxyAddresses

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35911

    Anonymous

    QuestionQuestion

    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.

    #35912

    Anonymous

    Accepted AnswerAnswer

    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.

    Source: https://serverfault.com/questions/887083/import-csv-of-user-accounts-containing-semicolon-delimited-proxyaddresses
    Author: mythofechelon
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.