Forum Discussion

Dave Carthy's avatar
Dave Carthy
Copper Contributor
Oct 16, 2018

Pre-Register users using AlternateEmailAddresses field for Azure SSPR

Hi Folks,

 

I have recently implemented SSPR in Azure and I would like to pre-register everyone in the system. I would like to populate the AlternateEmailAddresses field using the command below for 5000 people.

 

Set-MsolUser -UserPrincipalName user@domain.com -AlternateEmailAddresses @("email@domain.com")

 

I was wondering would anyone know how to script this in powershell using a csv file?  Any help would be appreciated. Maybe someone knows a better way of doing this? Again, thanks.

 

Regards,

Daithi

 

 

  • Assuming you have a blabla.csv with columns UserPrincipalName to designate the user and AltEmail to designate the alternate email address, try something like this:

     

    Import-CSV blabla.csv | % { Set-MsolUser -UserPrincipalName $_.UserPrincipalName -AlternateEmailAddresses @($_.AltEmail) }
  • Assuming you have a blabla.csv with columns UserPrincipalName to designate the user and AltEmail to designate the alternate email address, try something like this:

     

    Import-CSV blabla.csv | % { Set-MsolUser -UserPrincipalName $_.UserPrincipalName -AlternateEmailAddresses @($_.AltEmail) }
    • Dave Carthy's avatar
      Dave Carthy
      Copper Contributor

      Hi Vasil,

       

      Many thanks for that, it worked perfectly. I was close to getting it but it would have taken me ages to get it. Thanks again, I really appreciate the help.

       

      Daithi

Resources