miércoles, 2 de marzo de 2016

Remote Powershell to manage Office 365

Yhea, in the previous post I wrote about connecting to Office 365 using powershell in order to do taks related to Office 365.


But if we want to go a bit deep and do some Exchange tasks (For instance Get-Mailbox), we will need to connect into our  Exchange Online, if not we’ll get an error like:



So, in order to connect into our Exchange Online and be able to break everything … sorry, I mean to FIX everything, we should follow the next steps:


1- Update the default PowerShell Execution Policy

Set-ExecutionPolicy Unrestricted


2- Creating a Remote Session to Exchange Online. 
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession

NOTE: After that a window will pop up asking you for your credentials. You should enter your Office 365 admin user.

3- Done, you are connected to your Exchange Online. 
In order to check your connectivity, now you can run the command Get-Mailbox  

No hay comentarios:

Publicar un comentario