{"id":407,"date":"2019-11-20T18:40:58","date_gmt":"2019-11-20T18:40:58","guid":{"rendered":"http:\/\/www.torontohelpdesk.ca\/blog\/?p=407"},"modified":"2019-11-20T18:53:38","modified_gmt":"2019-11-20T18:53:38","slug":"office-365-get-list-of-all-accounts-and-aliases-via-powershell","status":"publish","type":"post","link":"https:\/\/www.torontohelpdesk.ca\/blog\/office-365-get-list-of-all-accounts-and-aliases-via-powershell\/","title":{"rendered":"Office 365 &#8211; Get list of all accounts and aliases via PowerShell"},"content":{"rendered":"\n<p><strong>Problem:<\/strong><\/p>\n\n\n\n<p>You need a list of all users and aliases<\/p>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<p>Get-Mailbox | Select-Object DisplayName,@{Name=\u201cEmailAddresses\u201d;Expression={$_.EmailAddresses |W here-Object {$_ -LIKE \u201cSMTP:*\u201d}}} | Sort | Format-List <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Or<\/p>\n\n\n\n<p>&#8216; Get-Mailbox | Select-Object\nDisplayName,@{Name=\u201cEmailAddresses\u201d;Expression={$_.EmailAddresses |Where-Object\n{$_ -LIKE \u201cSMTP:*\u201d}}} | Sort | Export-Csv &lt;file path i.e.\nC:\\Users\\admin\\Desktop\\test.csv&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: You need a list of all users and aliases Solution: Get-Mailbox | Select-Object DisplayName,@{Name=\u201cEmailAddresses\u201d;Expression={$_.EmailAddresses |W here-Object {$_ -LIKE \u201cSMTP:*\u201d}}} | Sort | Format-List Or &#8216; Get-Mailbox | Select-Object DisplayName,@{Name=\u201cEmailAddresses\u201d;Expression={$_.EmailAddresses |Where-Object {$_ -LIKE \u201cSMTP:*\u201d}}} | Sort | Export-Csv &lt;file path <a class=\"more-link\" href=\"https:\/\/www.torontohelpdesk.ca\/blog\/office-365-get-list-of-all-accounts-and-aliases-via-powershell\/\">Continue reading <span class=\"screen-reader-text\">  Office 365 &#8211; Get list of all accounts and aliases via PowerShell<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":2,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":409,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/407\/revisions\/409"}],"wp:attachment":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}