[PowerShell] PowerShell and Office 365

Install and configure the Microsoft Online Services Module for Windows PowerShell

1. Check the requirement for your environment

You need a Windows 7 or Windows Server 2008 R2 computer.
You must have Windows PowerShell and the .NET Framework 3.5.1 installed.
You must have the Microsoft Online Services Sign-in Assistant installed.

Notes: Links for related tools:
Windows Powershell 2.0:  http://support.microsoft.com/kb/968929/en-us
Install .NET Framework: http://msdn.microsoft.com/en-us/library/ff637712.aspx
Microsoft Online Services Sign-in Assistant:
(the above link is broken)use the following link to download



2.Install Microsoft Online Service Module for Windows

Download one of the following:

Microsoft Online Services Module for Windows PowerShell (32-bit version): http://g.microsoftonline.com/0BD00en-US/565
Microsoft Online Services Module for Windows PowerShell (64-bit version): http://g.microsoftonline.com/0bd00en-us/557
To install the cmdlets, double-click the AdministrationConfig.msi file. The installer will add a shortcut to your desktop and Start menu.


Here are some useful PowerShell scripts for Office 365:

1. Import related module

Import-Module MSOnline

2. Log into Office365 with a prompt credential dialog.

$credential=Get-Credential <UserName>

3. Log into Office 365 without any prompt dialog

$credential = New-Object System.Management.Automation.PsCredential '<userName>',(ConvertTo-SecureString -String '<password>' -AsPlainText -Force)
Connect-MsolService -Credential $credential

4. Get office 365 user

Get-MsolUser #get all
Get-MsolUser -UserPrincipalName <user account>

5. Remove office 365 user


To be added...



blog comments powered by Disqus