前言
一個難得的機會,接觸到 Exchange Online Powershell 操作。怕自己之後忘記如何設定,簡單紀錄一下如何透過 Windwos Powershell 連線至 Exchange online 並進行相關設定。本篇文章若有錯誤或任何建議,請各位先進不吝提出,謝謝。介紹
Exchange Online Powershell 可以讓您透過命令列的方式,管理並設定 Exchange Online。您可以使用 Windows Powershell 對 Exchange Online Powershell 工作 session,進而在本地機器設定 Exchange Online。1. 首先在 Windows 內以管理者權限開啟 Windows Powershell 或 Windows Powershell ISE
2. 若您是第一次透過 Windows Powershell 連線到 Exchange Online Powershell,請先輸入下列指令進行設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy RemoteSigned |
3. 首先輸入下列指令,彈出視窗輸入 Office 365 帳號密碼進行登入
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$UserCredential = Get-Credential |
4. 執行下列命令設定工作 Session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection |
5. 接下來執行下列指令,下載 Exchange Online Powershell 到 Windows Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-PSSession $Session -DisableNameChecking |
6. 完成後,即可透過指令設定 Exchange Onlin。您可以透過 Get-Mailbox 指令進行測試:
2 留言
請問一下,在步驟四的時候出現是為什麼?
回覆刪除這串 New-PSSession : [outlook.office365.com] 連線到遠端伺服器 outlook.office365.com 失敗,傳回下列錯誤訊息: 存取被拒。 如需
刪除詳細資訊,請參閱 about_Remote_Troubleshooting 說明主題。