Oct 16 2018
04:46 AM
- last edited on
Jan 14 2022
05:22 PM
by
TechCommunityAP
Oct 16 2018
04:46 AM
- last edited on
Jan 14 2022
05:22 PM
by
TechCommunityAP
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
Oct 16 2018 11:09 AM
SolutionAssuming 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) }
Oct 18 2018 12:59 AM
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
Oct 16 2018 11:09 AM
SolutionAssuming 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) }