{"id":115,"date":"2017-08-06T16:03:59","date_gmt":"2017-08-06T14:03:59","guid":{"rendered":"http:\/\/developer.ps\/?p=115"},"modified":"2017-08-06T16:03:59","modified_gmt":"2017-08-06T14:03:59","slug":"set-default-email-for-office-365","status":"publish","type":"post","link":"https:\/\/developer.ps\/index.php\/2017\/08\/06\/set-default-email-for-office-365\/","title":{"rendered":"Set default email for Office 365"},"content":{"rendered":"Depending on the information stored for the users in the AD, there is two ways this can be accomplished:\r\n\r\n1.Set email field and default email in ProxyAddresses according to UserPrincipalName:\r\n$users = Get-ADUser -Filter * -properties EmailAddress -SearchBase \"ou=Test,ou=Departments,dc=DOMAIN,dc=COM\"\r\nforeach ($user in $users) {\r\n    $useremail = $user.UserPrincipalName\r\n    Set-ADUser $user -Add @{'ProxyAddresses' = (\"SMTP:\"+$useremail )} -EmailAddress $useremail\r\n}\r\n2. Set default email in ProxyAddresses <a href=\"https:\/\/developer.ps\/index.php\/2017\/08\/06\/set-default-email-for-office-365\/\" class=\"more-link\">Read more [...]<\/a>","protected":false},"excerpt":{"rendered":"<p>Depending on the information stored for the users in the AD, there is two ways this can be accomplished: 1.Set email field and default email in ProxyAddresses according to UserPrincipalName: $users = Get-ADUser -Filter * -properties EmailAddress -SearchBase &#8220;ou=Test,ou=Departments,dc=DOMAIN,dc=COM&#8221; foreach ($user in $users) { $useremail = $user.UserPrincipalName Set-ADUser $user -Add @{&#8216;ProxyAddresses&#8217; = (&#8220;SMTP:&#8221;+$useremail )} -EmailAddress $useremail } 2. Set default email in ProxyAddresses Read more [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-powershell"],"wps_subtitle":"Powershell script to set default email for all AD users","_links":{"self":[{"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":1,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/posts\/115\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.ps\/index.php\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}