Why And How To Connect To Exchange PowerShell

Asked By 0 points N/A Posted on -
qa-featured

Give me the lessons to connect to Exchange PowerShell. I have tried several times but failed. Please answer step by step so that it will be more effective. Thanks in advance.

SHARE
Answered By 130 points N/A #330816

Why And How To Connect To Exchange PowerShell

qa-featured

Connecting to Exchange Online using remote PowerShell. There’s no secret to the fact that there are certain things to do with an exchange that can only be done through the Exchange Management Shell or PowerShell.

So, in those situations with an on-premise exchange environment. Its no problem you fire up the Exchange Management Shell, and you start using the commands that you know will enable certain features for you to work with your on-premise exchange, but what you do when you are working with exchange online through office 365. Well, in those scenarios, you’re going to have to make a remote PowerShell connection to perform the task. So, this comment was going to learn with the auditing feature. With auditing, you need to use the shell o enable the feature.

I’ll show you how to utilize Windows PowerShell to make a connection to exchange online to perform command-line tasks. Well we are working with office 365 here and this gives us a unique opportunity because if you are working with the on-premise exchange you would simply open up your Exchange Management Shell, and you would begin the process of using the setup mailbox commandlet and then enabling the mailbox audit logging for a specific end-user or for your entire organization depending upon what you are looking to do. In our case here, if you make this happen if you can only do it through the shell and you can’t do it through the office 365 GUI here.

Well, you know you could make a connection to your exchange through PowerShell. This is unique and, it allows us to demonstrate something that most folks don’t ever see even though they know it can probably be done, and typically, they will work through the GUI if they can. We will be going to do this with remote PowerShell because it works fine for me.

Before beginning you need to know you can use the following versions of Windows:

  • Windows 10
  • Windows 8.1
  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012 or Windows Server 2012 R2
  • Windows 7 Service Pack 1 (SP1)*
  • Windows Server 2008 R2 SP1*

Here are the steps.

  1. open up the PowerShell command.
  2. Type this command “Set-ExecutionPolicy RemoteSigned”. And tap enter.
  3. Tap Y as the command ask Do you want to exchange the execution policy?
  4. Type the command “$UserCredential = Get-Credential”. Hit enter.
  5. A new pop window opens up asking to Enter your credentials. Feed the Username and Password. Tap OK.
  6. Now copy this command and paste it in the section “$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection”. Hit enter.
  7. It says your connection has been redirected to the following URL, which is a good thing. Now we have to import the session.
  8. Run “Import-PSSession $Session”. Hit enter. It will diagnose the system.

Well, we are now connected to the Office 365 connection through PowerShell.  Now you could just turn around and can do a simple get mailbox to see everyone’s mailbox of your organization.

Related Questions