# encoding: ascii
# api: powershell
# title: Get-O365
# description: Just a simple function to show how to query Office 365 via powershell
# version: 0.1
# type: function
# author: Jeremy D Pavleck
# license: CC0
# function: Get-O365
# x-poshcode-id: 4831
# x-archived: 2014-01-29T05:09:17
# x-published: 2014-01-22T15:29:00
#
#
Function Get-O365 {
$cred = Get-Credential -Message "Your username is your email address for O365"
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session
$myMB = Get-Mailbox

Write-Host -ForegroundColor "Green" "Hello $($myMB.Name), your email address is $($myMB.WindowsEmailAddress), and your account was created $($myMB.WhenCreated)"
}
