Check for profiles
PS C:\> Test-Path $profileCreate a profile
New-Item $profile -ItemType File -Forceedit the profile script using PowerShell ISE to make a customized function:
powershell_ise.exe $profilehttp://exchangeserverpro.com/create-powershell-profile/
Customized function:
Function Connect-EXOnline {
$URL = "https://ps.outlook.com/powershell"
$Credentials = Get-Credential -Message "Enter your Office 365 admin credentials"
$EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URL -Credential $Credentials -Authentication Basic -AllowRedirection -Name "Exchange Online"
Import-PSSession $EXOSession
}
Function Disconnect-EXOnline {
Remove-PSSession -Name "Exchange Online"
}
Open a new session and run the functions
Connect-EXOnlineLog in with your Office 365 admin credentials.
Sample function:
Check for mailboxes
Get-Mailbox
Be sure and disconnect
Disconnect-EXOnline
http://exchangeserverpro.com/powershell-function-connect-office-365/
No comments:
Post a Comment