February 23, 2016 · microsoft powershell office365

Office 365 powershell tips

This piece of powershell code will allow you to connect to office365

$cred = Get-Credential -Credential $user  
  Import-Module MSOnline  
  Connect-MsolService -Credential $cred  
$msoExchangeURL = “https://ps.outlook.com/powershell/”  
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection  
 
Import-PSSession $session