Skip to content

Instantly share code, notes, and snippets.

@bmkaiser
Last active May 21, 2020 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmkaiser/6bd33f70a27648064f0a2b61a1608852 to your computer and use it in GitHub Desktop.
Save bmkaiser/6bd33f70a27648064f0a2b61a1608852 to your computer and use it in GitHub Desktop.
Fewer Keystrokes to Connect to Exchange Online with PowerShell
$env:UPN = (whoami /upn)
$PSDefaultParameterValues = @{
'Connect-ExchangeOnline:UserPrincipalName' = "$env:UPN"
}
Set-Alias -Name cexo -Value Connect-ExchangeOnline
@bmkaiser
Copy link
Author

Overview

Add this code to your PowerShell profile to reduce the amount of typing required to connect to Exchange Online with the V2 module.

Before

Connect-ExchangeOnline -UserPrincipalName email@domain.com

After

cexo

Resources & Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment