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

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -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


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.