Skip to content

Instantly share code, notes, and snippets.

@Tawmu
Last active August 29, 2015 14:04
Show Gist options
  • Save Tawmu/f548748f2e36139c3ed6 to your computer and use it in GitHub Desktop.
Save Tawmu/f548748f2e36139c3ed6 to your computer and use it in GitHub Desktop.
Powershell one-liner used to get all users in an Active Directory OU and update their main SMTP proxyAddress with [email protected].
get-aduser -searchbase "OU=test,DC=domain-internal,DC=co,DC=uk" -Filter * -Properties ProxyAddresses,GivenName,Surname | foreach {set-aduser -Identity $_.SamAccountName -Add @{ProxyAddresses=“SMTP:”+$_.givenname+”.”+$._surname+”@domain-external.co.uk”}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment