How to Connect to Exchange Online Using Remote PowerShell. Adding a Domain and Bulk Modifying Email Addresses. ==================================================================================== 1. Add a Domain to Office 365. 2. Connect to Exchange Online. Edit the PowerShell profile to automate the process. # Check whether you have a CurrentUserCurrentHost PS profile: Test-Path $PROFILE.CurrentUserCurrentHost # and if there isn't one, create it: new-item $PROFILE.CurrentUserCurrentHost -ItemType file -Force # Automate the Remote PS to Office 365 and Exchange online Import-Module MSOnline $msolcred = get-credential connect-msolservice -credential $msolcred $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $msolcred -Authentication Basic -AllowRedirection Import-PSSession $Session 3. Get a list of the user accounts and export it to a CSV file. Get-MsolUser | select UserPrincipalName, FirstName, LastName Get-MsolUser | select UserPrincipalName, FirstName, LastName | Export-Csv NetoMeter-Users.csv 4. Bulk Modify UserPrincipalName.