Connect to Office365 from Windows 7 with PowerShell

PowerShell is an incredibly powerful tool that for Windows Sysadmins is a must. Once you start using it you will not stop.  Microsoft does not give you access to the back end management software for Exchange so PowerShell is a must if you are going to use Office365 for a business.

Windows 7 by default will not let you connect to Office365 via PowerShell so there are a few steps that you will need to take before you can start using Powershell to manage your Office365 domain.

 

  • Make sure you have the latest version of PowerShell installed, if not then update it
  • Make sure that you have .NET 3.5.1 installed if not then install it
  • Download and install the Microsoft Online Services Sign-in assistant 
  • Install the Office 365 Cmdlets either 64 Bit or 32 Bit (check out this post if you don’t know what a Cmdlet is)

Now you should be able to connect to Office365 via Powershell in Windows 7. To do this run the following script:

Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $O365Cred