Connect Office 365 with Windows PowerShell
Add permission
To run scripts in Windows PowerShell, we need to run the following command as an administrator. To do this we start the PowerShell as administrator (right mouse button and choose to run as administrator). This command only needs to be executed once.
PS C:\> |
|
Establish connection
Now start a normal PowerShell without administrator privileges and execute the following commands:
Login with your Office 365 credentials
PS C:\> |
|
To start the session execute:
PS C:\> |
|
PS C:\> |
|
Check connection
To check if you are connected, you can print some mailbox information with:
PS C:\> |
|
Close connection
If you are done, close the session with:
PS C:\> |
|
References
Windows Docs - Connect to Exchange Online PowerShell
Windows Docs - Get-Mailbox
https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/Get-Mailbox?view=exchange-ps
Kommentare