Connect to Office365 Powershell

14 Apr

So you may have noticed the incredible new feature that Microsoft have rolled out to your Office 365 tenancy called “clutter”

Pain in the ass.

To disable it and to carry out many of useful admin tasks you can connect to your hosted exchange online using the following instructions – Note Im using Win10 on VMWARE Fusion

 

Open powershell as administrator

Connect PowerShell to Exchange Online

I always recommend running PowerShell as an administrator. To do that, right click on the PowerShell icon and select Run As Administrator from the context menu.

PowerShell Run As Adminstrator

First we need to set the execution policy.

 C:\> Set-ExecutionPolicy RemoteSigned

Next we need to store our Office 365 credentials in a variable. Type the command below and hit enter.

 C:\> $UserCredential = Get-Credential

A dialog box will appear. Type in your Office 365 credentials and click Ok.

Exchange Online PowerShell Credential Variable

The account you use will need permissions to Exchange Online. By default only Global Administrators in Office 365 have Organization Management rights in Exchange Online.

Now let’s connect. In the command below we put our connection info into a variable. This results in less typing later.

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

Finally, let’s use that variable to connect to Exchange Online and import all Exchange cmdlets into our session.

 C:\> Import-PSSession $Session

To disable clutter for your whole tenancy run the following command;

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $false

Until next time

Sai
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: