trying to update proxy addresses in AADSync 365 domain via PS

Home Forums Scripting PowerShell trying to update proxy addresses in AADSync 365 domain via PS

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    James Haynes
    Member
    #167639

    and its kicking my ass. i will preface this with i am not a scripting master, but i know how to hack up stuff enough to make it work, but this one is driving me crazy…

    #Import Modules
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
    Import-Module ActiveDirectory

    #Set a password
    $securePassword = ConvertTo-SecureString “pass4FMH!” -AsPlainText -Force

    ## Prompt for CSV path
    $filepath = Read-Host -Prompt “Enter CSV path”

    #Import The file into varibles…
    $users = Import-Csv $filepath

    #loop and gather data
    ForEach ($user in $users) {

    #Gather user info
    $fname = $user.’First Name’
    $lname = $user.’Last Name’
    $dname = $user.DisplayName
    $name = $user.Name
    $sam = $user.SAM
    $OU = $user.OU
    $email = $user.Email
    $logon = $user.SAM
    $description = $user.Description

    #create new AD user for each item in CSV
    New-ADUser -Name “$fname $lname” -GivenName $fname -Surname $lname -UserPrincipalName “$sam” -Path $OU -EmailAddress $email -Description $description -Enabled $true -AccountPassword $SecurePassword

    #echo output for each user
    echo “Account created for $fname $lname with $logon in $OU folder”

    }[/CODE]

    so i have this crazy tenant and their are about 50 domains parsed out… i have to specify the primary and secondary smtp addresses for all this to work, so i am trying to add the field for “proxyAddresses” but i cant get it to do more than the primary email address. i would like the script to populate the field in ADUC advanced view, Attribute Editor: SMTP:[email protected] smtp:[email protected], smtp:[email protected], etc etc…

    so what do i have to do to get it to populate that field and secondly, how do i format it to create new entries. i tried just separating with a comma by hacking things up but i ended up with an email address like “[email protected],[email protected]” like one single address…

    this last place we acquired has been a hastle cause i have a couple hundred addresses to update with the other domain.. like we got a place that is actually 2 stores, so the users would like to have a secondary address for that location as well as their primary… which i dont normally do and i thought it would be easier to fix with a script (so long as i can get it to work). i just dont get the separate entries in that field and/or how to pull this off in PS.

    thanks in advance!

    James[CODE]#Import Modules
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
    Import-Module ActiveDirectory

    #Set a password
    $securePassword = ConvertTo-SecureString “pass4FMH!” -AsPlainText -Force

    ## Prompt for CSV path
    $filepath = Read-Host -Prompt “Enter CSV path”

    #Import The file into varibles…
    $users = Import-Csv $filepath

    #loop and gather data
    ForEach ($user in $users) {

    #Gather user info
    $fname = $user.’First Name’
    $lname = $user.’Last Name’
    $dname = $user.DisplayName
    $name = $user.Name
    $sam = $user.SAM
    $OU = $user.OU
    $email = $user.Email
    $logon = $user.SAM
    $description = $user.Description

    #create new AD user for each item in CSV
    New-ADUser -Name “$fname $lname” -GivenName $fname -Surname $lname -UserPrincipalName “$sam” -Path $OU -EmailAddress $email -Description $description -Enabled $true -AccountPassword $SecurePassword

    #echo output for each user
    echo “Account created for $fname $lname with $logon in $OU folder”

    }[/CODE]

    so i have this crazy tenant and their are about 50 domains parsed out… i have to specify the primary and secondary smtp addresses for all this to work, so i am trying to add the field for “proxyAddresses” but i cant get it to do more than the primary email address. i would like the script to populate the field in ADUC advanced view, Attribute Editor: SMTP:[email protected] smtp:[email protected], smtp:[email protected], etc etc…

    so what do i have to do to get it to populate that field and secondly, how do i format it to create new entries. i tried just separating with a comma by hacking things up but i ended up with an email address like “[email protected],[email protected]” like one single address…

    this last place we acquired has been a hastle cause i have a couple hundred addresses to update with the other domain.. like we got a place that is actually 2 stores, so the users would like to have a secondary address for that location as well as their primary… which i dont normally do and i thought it would be easier to fix with a script (so long as i can get it to work). i just dont get the separate entries in that field and/or how to pull this off in PS.

    thanks in advance!

    James

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.