This one liner works like a charm:<\/p>\n
Get-ADUser -Filter { proxyAddresses -like “[email protected]<\/a><\/em>”} -Properties SamAccountName, EmailAddress, enabled | Select samAccountName, emailaddress, enabled<\/p>\n
Need to read multiple proxyAddresses from csv file, but this is not working:<\/p>\n cls ForEach($Item in $UserId) Get-ADUser -Filter { proxyAddresses -like “$item.email”} -Properties SamAccountName, EmailAddress, enabled | ` }<\/p>\n Here’s the csv file Email.csv<\/p>\n Email This one liner works like a charm:<\/p>\n Get-ADUser -Filter { proxyAddresses -like “[email protected]<\/a><\/em>”} -Properties SamAccountName, EmailAddress, enabled | Select samAccountName, emailaddress, enabled<\/p>\n Need to read multiple proxyAddresses from csv file, but this is not working:<\/p>\n cls ForEach($Item in $UserId) Get-ADUser -Filter { proxyAddresses -like “$item.email”} -Properties SamAccountName, EmailAddress, enabled | ` }<\/p>\n Here’s the csv file Email.csv<\/p>\n Email Many ways to solve this, you need a dynamic way to update your filter.<\/p>\n If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n
\nImport-Module ActiveDirectory
\n$count = 0
\n$UserId = Import-Csv c:\\temp\\EMail.csv<\/p>\n
\n{<\/p>\n
\nSelect samAccountName, emailaddress, enabled<\/p>\n
\n[email protected]<\/a><\/em>
\n[email protected]<\/a><\/em>
\n[email protected]<\/a><\/em><\/p>","upvoteCount":6,"answerCount":4,"datePublished":"2022-08-08T13:06:16.000Z","author":{"@type":"Person","name":"miriampabon1732","url":"https://community.spiceworks.com/u/miriampabon1732"},"suggestedAnswer":[{"@type":"Answer","text":"
\nImport-Module ActiveDirectory
\n$count = 0
\n$UserId = Import-Csv c:\\temp\\EMail.csv<\/p>\n
\n{<\/p>\n
\nSelect samAccountName, emailaddress, enabled<\/p>\n
\n[email protected]<\/a><\/em>
\n[email protected]<\/a><\/em>
\n[email protected]<\/a><\/em><\/p>","upvoteCount":6,"datePublished":"2022-08-08T13:06:16.000Z","url":"https://community.spiceworks.com/t/proxyaddress/933023/1","author":{"@type":"Person","name":"miriampabon1732","url":"https://community.spiceworks.com/u/miriampabon1732"}},{"@type":"Answer","text":"