A quick search for "powershell modify proxyaddresses" would have supplied you with an answer very quickly.
how-to-bulk-update-proxyaddresses-attribute
add all aliases to user account
Hi all,
I have a csv file with all aliases which we need to add to user accounts under proxyaddresses. CSV file contains name,sam,upn, emailaddress and all aliases. Problem here is that some of the users have up to 8 aliases and my question is how to add those aliases with ps. I understand that i need to use foreach but what to do when you have multiple entries. All aliases are in separate column in excel and my question is how to add those in script
2 answers
Sort by: Most helpful
-
Rich Matheisen 46,476 Reputation points
2020-10-21T19:08:43.737+00:00 -
Ian Xue (Shanghai Wicresoft Co., Ltd.) 35,996 Reputation points Microsoft Vendor
2020-10-22T07:13:20.91+00:00 Hi,
You need multiple loops. The outer loop traverse the accounts and the inner loop traverse the 8 aliases, like this$users = Import-Csv file.csv foreach($user in $users){ get-asduser -filter {SamAccountName -eq $user.sam} ...| ForEach-Object{ $_.alias1 $_.alias2 ... } }
Best Regards,
Ian============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.