[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:
http://office.microsoft.com/en-us/word-help/reinstall-microsoft-online-services-sign-in-assistant-HA102065466.aspx
(the above link is broken)use the following link to download

http://blog.powershell.no/2011/05/09/administering-microsoft-office-365-using-windows-powershell/

 

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
Get-MsolUser

4. Get office 365 user

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

5. Remove office 365 user

Remove-MsolUser 

To be added...

Reference:

http://onlinehelp.microsoft.com/en-us/office365-enterprises/hh125001.aspx

blog comments powered by Disqus