How to Gain Access to Office 365 via PowerShell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\soonkok.goh> set-executionpolicy unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
PS C:\Users\soonkok.goh> $LiveCred = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PS C:\Users\soonkok.goh> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outloo
k.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
WARNING: Your connection has been redirected to the following URI:
"https://pod51022psh.outlook.com/PowerShell-LiveID?PSVersion=2.0 "
WARNING: Your connection has been redirected to the following URI:
"https://hkxprd0410psh.outlook.com/PowerShell-LiveID?PSVersion=2.0 "
PS C:\Users\soonkok.goh> Import-PSSession $Session
ModuleType Name ExportedCommands
---------- ---- ----------------
Script tmp_4901148a-5804-4b7b... {Set-RoleGroup, Set-RMSTrustedPublishingDomain, Disable-UMAutoAttendant,...
PS C:\Users\soonkok.goh> Get-RecipientPermission -Identity catherine.yam@les-affaires.com | select trustee,accesscontrol
type,accessrights
Trustee AccessControlType AccessRights
------- ----------------- ------------
NT AUTHORITY\SELF Allow {SendAs}
PS C:\Users\soonkok.goh> Get-Mailbox -Identity catherine.yam |select grantsendonbehalfto