If you are using Window 1o then Powershell is already installed in the system.Below is the snapshot,In the Windows search on bottom left of your screen type Powershell Right click and Run as admin.

Run the below commands one by one

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

Enter your super admin username and password of that domain

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

( Note: As powershell command is a commands based all commands should be in the same line)

Import-PSSession $Session -DisableNameChecking

A quick test is to run an Exchange Online cmdlet,Run the below command,  and see the results.


Remember to use Remove-PSSession $Session to remove the connection once you have performed the all the activities

Below is the example to send a test mail and to know if there is any issue in sending the mails

Send-MailMessage -To destination email ID -From source email ID  -Subject Test mail from Powershell  -Body This is Test mail from Powershell do not reply -Credential (Get-Credential) -SmtpServer smtp.gmail.com -Port 587 -UseSsl

To Connect to all office 365 services in Powershell follow the below steps as per the link