To manage Exchange Online (Office 365) remotely, you can use Remote PowerShell command lines. Creating remote PowerShell session to Exchange Online is a simple 3 step process.
To enable Windows PowerShell to run signed scripts, run the following command in an elevated Windows PowerShell window (a Windows PowerShell window you open by selecting Run as administrator):
Set-ExecutionPolicy RemoteSigned (this is a one-time configuration on your computer). Now you are all set to connect to Exchange Online.
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Be sure to disconnect the remote PowerShell session when you're finished using command below.