ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Can You Export List of Email Accounts from Office 365

    IT Discussion
    email office 365 o365 exchange
    7
    10
    747
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      That's what I want... basically a list (preferably comma separated) of every email account (not alias) that we have in Office 365. Anyone know if that is possible, and if so, how do we find it? Probably some PowerShell command will do that.

      KellyK 1 Reply Last reply Reply Quote 0
      • KellyK
        Kelly @scottalanmiller
        last edited by

        @scottalanmiller said in Can You Export List of Email Accounts from Office 365:

        That's what I want... basically a list (preferably comma separated) of every email account (not alias) that we have in Office 365. Anyone know if that is possible, and if so, how do we find it? Probably some PowerShell command will do that.

        It contains a lot of additional information, but you can export your list of users in a CSV by clicking the Export button on the Users page.

        1 Reply Last reply Reply Quote 1
        • Mike DavisM
          Mike Davis
          last edited by

          get-mailbox | export-csv
          doesn't do it?

          1 Reply Last reply Reply Quote 2
          • RomoR
            Romo
            last edited by

            From the exchange admin.

            Screenshot from 2019-03-06 10-06-49.png

            1 Reply Last reply Reply Quote 1
            • DustinB3403D
              DustinB3403
              last edited by

              This should do what you want.

              https://www.codetwo.com/admins-blog/list-of-active-mailboxes-powershell/

              1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403
                last edited by

                What you should specifically be pulling though is accounts that are licensed.

                https://docs.microsoft.com/en-us/office365/enterprise/powershell/view-licensed-and-unlicensed-users-with-office-365-powershell

                I had a script that did this before. . . I wonder if I still have it around.

                1 Reply Last reply Reply Quote 1
                • DustinB3403D
                  DustinB3403
                  last edited by

                  Here is the script I wrote a while ago

                  $UserCredential =Get-Credential
                  $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
                  # "Import-PSSession $Session" Uses 1 of 3 available powershell connections to the server
                  # "Get-Mailbox" will list all user mailboxes on the office 365 server. 
                  
                  # "Remove-PSSession $Session" must be applied when the session is completed otherwise all Powershell sessions may be used, and you must wait for timeout. 
                  Set-ExecutionPolicy RemoteSigned
                  Import-PSSession $Session
                  (Get-Mailbox) | Foreach {Get-MailboxStatistics $_.Identity | Select DisplayName, LastLogonTime} | Export-CSV $Home\Desktop\LastLogonDate.csv
                  Remove-PSSession $Session
                  

                  This specifically list their last login, but would be easily changed for what you need.

                  jmooreJ 1 Reply Last reply Reply Quote 1
                  • scottalanmillerS
                    scottalanmiller
                    last edited by

                    Thanks guys, we got a list. And of course, by the time that we pulled it, they aren't sure if they need it anymore. 🤦

                    1 Reply Last reply Reply Quote 0
                    • jmooreJ
                      jmoore @DustinB3403
                      last edited by

                      @DustinB3403 That looks useful, thanks, goign to put that into my Boostnote app.

                      1 Reply Last reply Reply Quote 0
                      • dafyreD
                        dafyre
                        last edited by

                        I have a script that I wrote to do this.

                        https://gitlab.com/dafyre/powershell-utils/raw/master/export-O365Group.ps1

                        It gets you the person's DisplayName and their email address.

                        If you're exporting a Distribution List, just add the -distributionlist switch.

                        If you're exporting an Office 365 Group (Unified Group), then leave that switch out. Other parameters should be self explanatory.

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post