The original content is derived from: https://technet.microsoft.com/en-us/library/jj984289(v=exchg.160).aspx
To start you must open WIndows Powershell as administrator - type powershell into search, then right click the program and select 'Run As Administrator'
Enter each of these commands into Powershell:
Firstly allow commands to be imported from Microsoft online with the follow command:
set-executionpolicy remotesigned
Then obtain the Office 365 credentials for the purpose of the connection:
$UserCredential = Get-Credential
The following command sets the connection to go to Microsoft Exchange using the credentials entered so far:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Now with a connection established, bring the session to the forefront for action:
Import-PSSession $Session
You can now run the required commands as needed. There are a great number of tasks available via Powershell and you will need to look these up separately.
When finished, be sure to complete the session and finish with the following command:
Remove-PSSession $Session