Tuesday, January 03, 2012

Office 365 - Powershell connection

To connection to Office 365 use the following set of commands.  Firstly let Powershell have permission to run remotely signed scripts.  Then set the credentails to logon with, create a Powershell session to Office365.  Import the commands you can use in that session and then off you go....

Set-ExecutionPolicy RemoteSigned
$LiveCred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Once you have a session then you can use commands to assign permissions such as:

Add-MailboxPermission "Telephone Messages" -User IanSmit@mycompany.com -AccessRights FullAccess

No comments: