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.
-
@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.
-
get-mailbox | export-csv
doesn't do it? -
From the exchange admin.
-
This should do what you want.
https://www.codetwo.com/admins-blog/list-of-active-mailboxes-powershell/
-
What you should specifically be pulling though is accounts that are licensed.
I had a script that did this before. . . I wonder if I still have it around.
-
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.
-
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.
-
@DustinB3403 That looks useful, thanks, goign to put that into my Boostnote app.
-
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.