Need help importing ProxyAddresses based off UserPrincipalName

I’ve used this script to import ProxyAddresses via Set-ADuser based off SamAccountName, but I have a need to alter it to key off of UserPrincipalName instead.

$admail=Import-CSV C:proxyaddresses.csv Foreach ($a in $admail) { Set-ADUser $a.SamAccountName -Clear proxyaddresses $a.proxyaddresses -split “;” | % {Set-ADUser $a.samaccountname -Add @{proxyaddresses=$_ +” “}}# } 

The data source also contains DisplayName, FirstName, & LastName if that’s any easier to key off of?

Any help would be greatly appreciated.

submitted by /u/Nepenthe_x64
[link] [comments]

Leave a Reply