http://technet.microsoft.com/en-GB/library/jj984289(v=exchg.150).aspx

Using Powershell to connect to Office 365

Firstly, you need to create a connection to Office 365. You can do this by typing (or copying/pasting) the following into Powershell.

$UserCredential = Get-Credential

Once this is in the Powershell window, press Enter to execute the command.

clip_image001

Now you simply type in the username and password for an Administrator account in your Office 365 and click OK. You will probably see some warnings.  Don’t worry, they are normal.You are now authenticated into Office 365. The last step is to connect up to Office 365 by using the following Powershell command:

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

Import-PSSession $session

Now you’ve gone to all the trouble of connecting to Powershell, let’s do something to prove that it works. Type the following into the Powershell window and press Enter:

Get-mailbox

clip_image002

Close session once completed: Remove-PSSession $Session

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s