office365: remotely connect to exchange online via powershell

run this first if you haven’t already:
Set-ExecutionPolicy RemoteSigned
you’ll probably want to switch back to Set-ExecutionPolicy Unrestricted once done

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

at this point run desired PS cmdlets like so:
Get-MailboxStatistics -Identity [UPN]

to end the session:
Remove-PSSession $Session

source:
https://technet.microsoft.com/en-us/library/jj984289%28v=exchg.150%29.aspx

This entry was written by resinblade , posted on Thursday June 11 2015at 06:06 pm , filed under IT . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

Comments are closed.