Exchange logs with powershell - 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

Related

Exchange online can I get a list of all mailboxes

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.

How do I do authentication for my powershell scripts for Microsoft 365/AzureAD/Exchange Online automation?

So I can successfully run commands to manage our Microsoft 365/AzureAd/Exchange Online - this involves assigning and removing license, converting user to a shared mailbox, delegating access to a mailbox, etc. I followed the guide here for authentication. But that's me actually logging in with my credentials + MFA (Multi-factor authentication) for authentication.
I want to have a script that does these type of actions triggered by a schedule. I believe I can include the credentials but how to do MFA? Tried to follow this but getting error clientid is not a guid I have registered an app in https://portal.azure.com/ and able to do Graph API calls using that. No luck in PowerShell authentication though. Any thoughts? Thanks!
Maybe try this? It should allow you to connect to all Microsoft online services and includes support for MFA. If it does not work, the website has many other scripts you can try
This is not possible. A potential solution is to set some rules where in specific case, MFA will not be required.

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.

pswa powershell web access custom configuration rules

Goal: Give users an account (domain user or basic, doesn't matter) and have them use Get-DhcpServerv4Lease cmdlet to convert their DHCP leases to reservations via the powershell web access feature using a web browser.
Issue/problem: I already made my own AuthorizationRule by importing that specific cmdlet but I feel like its missing others modules in order to authenticate/login? I can login if I grant microsoft.powershell configurationrule but cant if I grant the custom one that I made.
Error received upon login with my own custom configuration:
The Windows PowerShell Web Access gateway cannot establish a connection to the destination computer. Contact the gateway administrator. The error at the gateway is: The WS-Management service cannot process the request. The service is configured to reject remote connection requests for this plugin.
Question: Is there some other module I need to add to my custom rule or maybe there is a way to know what permissions microsoft.powershell contains so that I could mirror/copy them into my own rule?
Thanks
The quick answer: Remote Powershell needs to be enabled on the target system!
You can use System names, IP addresses or the FQDN. All of them will work (Use a mix as well)
To keep your Rules simple: Use Groups! Here is a Gist that could help you a bit. I have just a few rules and use AD Groups to manage the access (Systems and Users)
Please execute this (in an elevated PowerShell): Enable-PSRemoting -Force
You have to do this on all systems that you would like to access via the Web Gateway.
You will find a lot more Info about this on TechNet.

Setting up new Exchange Online users on RDS servers

My company is currently migrating our on prem Exchange users to the hosted Exchange Online platform. Migrating users is easy but we have hit a snag when on boarding new users. Our environment has multiple RDS servers. In the past we would setup a users mailbox on one server and when they would log in to another server the settings would follow them. That does not seem to be the case with Exchange Online. We are having to logon to each RDS server and manually set them up each time they logon to a new one(only for new users). If the user had an old on prem Exchange account that we migrated to the cloud then those settings get over-written and their Exchange Online account comes over no problem. Just trying to figure out a way that will setup the new user EOL accounts when they logon to the new servers. We are using Roaming profiles too if that helps. Maybe some sort of powershell script that I can modify with the new users names when I am setting them up?
Sounds like the AutoDiscovery isnĀ“t working correctly. Please check with the Microsoft Remote Connection analyzer if you see any errors (e.g. as explained in KB 2404385). Here is by the way a good starting point how that should work.