Skip to main content
Logging In to PowerShell
T
Written by Team
Updated over 3 years ago

For MFA protected accounts follow steps in Microsoft Official Docs.

Start Console

Run PowerShell Console as the Administrator, then execute commands in the following order.

Set Execution Policy

You need to configure this setting on your computer only once, not every time you connect.

Set-ExecutionPolicy RemoteSigned

Set User Credentials

In the Windows PowerShell Credential Request dialog box, enter your Office 365 user name and password, and then click on OK.

$UserCredential = Get-Credential

Start New Session

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import Session

Import-PSSession $Session

Remove Session

Remove-PSSession $Session

Be sure to disconnect the remote PowerShell session when you have finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you will need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the command above.

Did this answer your question?