Exchange online can I get a list of all mailboxes - powershell

I need to get a list of all mailboxes.
Can I get this list with EWS and PowerShell?
Exchange online shell will not be installed on the server where I run the script.
Thanks for your support

With PowerShell you can just simple call the Get-MailBox powershell command.
This is working for on-premise and O365 mailboxes as well. For O365 environment sooner or later you will need to transfer to modern authentication, but basic authentication will still work for a while. This is the easier way of I can think of.
Based on my knowledge it's not possible to list all mailboxes using entirely with EWS.

Related

Exchange Hybrid - All Remote Mailboxes - Populating msexchExternalDirectoryObjectId for get-remotemailbox

We have a hybrid exchange environment that has all it mailboxes online. ExternalDirectoryObjectId is present in the results for EXO or Azure Powershell user management tools.
However, when i run Onprem Exchange PowerShell tools such as get-remotemailbox against users, the ExternalDirectoryObjectId property is listed but blank.
I have synced msDS-ExternalDirectoryObjectId back from Azure and this populates ExternalDirectoryObjectId for local AD get-aduser commands but not OnPrem Exchange tools.
I think i need to populate the AD user property msexchExternalDirectoryObjectId but i am unsure exactly how to set this up in in AD connect or what online property to sync with?
Has anyone had this issue before and can offer any advice on how to resolve it?

Accessing a SMTP/IMAP mailbox using powershell

I need a library/API allowing me to connect to a SMTP/IMAP server with authentication using powershell.
I need to adapt a powershell script that uses EWS to access an Exchange server.
This Exchange Server will be shut down and we need to adapt that script for SMTP/IMAP.
This script looks into a mailbox for inbox and sent email and search some mail from their subjects using the EWS objects.
Thanks guys, but i can't find what i need with the APIs you gave me.
Closing the question.

log all powershell commands run on o365 tenant

I am wondering if there is a way to get a log of every powershell command ever run on our Office 365 server, and which user ran it? Can get the commands run in current powershell session but not historically...
advice is appreciated
You can search the Administrator Audit Logs which records the use of the Exchange Cmdlets https://technet.microsoft.com/en-us/library/dn342832(v=exchg.150).aspx. The other way the covers Sharepoint as well is the new Activity API https://msdn.microsoft.com/en-us/office-365/office-365-management-activity-api-reference

Find owner of shared Office 365 shared mailbox with PowerShell

Is it possible to find the owner of a shared mailbox hosted in Office 365 with PowerShell as a non-admin user? I am able to find this information manually through Outlook, but that is not a feasible approach for a large number of shared mailboxes. So I thought that it must be some way to get this information through PowerShell.
It seems that Microsoft offers a lot of PowerShell cmdlets that you can run on the Exchange server itself, but I don't have admin access to it, and I don't want it either. So is this possible to solve as a normal user?

Exchange logs with powershell

I am trying to get connection logs from exchange online via powershell.
I have managed to log in to exchange online with powershell, but do not know any cmdlets that would allow me to obtain a list of connections made. What I am trying to achieve is to see a log entry when someone has logged in to their mailbox and downloaded their emails. Ideally I am looking for their IP.
get-logonstatistics no longer works (exchange 2013).
Any help at all would be greatly appriciated!
For On-Premise Exchange you are looking forMailbox Transport service logs which sit in
%ExchangeInstallPath%TransportRoles\Logs\Mailbox\Connectivity
but you have to explicitly enable them first.
This article will get you started
http://technet.microsoft.com/en-us/library/bb124500(v=exchg.150).aspx
You can't really do that in O365 without raising a ticket with MS, the only available cmdlets are:
http://help.outlook.com/en-us/140/dd575549.aspx