How to connect to Office 365 from powershell

MS Outlook & Exchange sucks but that's what my company supports. I am not going to discuss why I need it this... it will end up in an unnecessary flame.

Required software:

Connect to the 365 system with:

[codesyntax lang="powershell"]

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

[/codesyntax]

Note: if you have Windows 10 (please start powershell as Administrator, otherwise it won't work), then you will have to use this code:

[codesyntax lang="powershell"]

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

[/codesyntax]

Scrie si tu o vorbulita


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.