Use PowerShell AD To Add A Proxy Address To All users In A Specific OU With FirstName.LastName Format

Following my series about Active Directory PowerShell Module today I’ll show you a PowerShell script that will add an SMTP Proxy address to all users In a specific OU based on their firstName And LastName.

In the example below I’m adding a primary SMTP address based on Firstname.Lastname@test.local to all the users In the DEV OU.

Get-ADUser -Filter 'Name -like "*"' -SearchBase 'OU=dev,DC=test,DC=local' -Properties * | % {Set-ADUser $_ -add @{proxyAddresses="SMTP:"+ $_.GivenName + '.' + $_.Surname +"@test.local"}}

The line below will just show the Proxy Address of all users with Title “Nano Admin”

Get-ADUser -Filter 'Title -like "Nano Admin"' -Properties * | select name,proxyAddresses

Leave a Reply