Office 365 系列之十一:使用 Windows PowerShell 管理 O365 平臺
先決條件
安裝 Azure AD 模塊的系統要求
Windows 10、Windows 8.1、Windows 8、Windows 7、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012 或 Windows Server 2008 R2。
軟件要求及下載鏈接
Microsoft Online Services 登錄助手,下載鏈接如下:
https://www.microsoft.com/zh-cn/download/details.aspx?id=41950
Microsoft Azure Active Directory 模塊,下載鏈接如下:
https://connect.microsoft.com/site1164/Downloads/DownloadDetails.aspx?DownloadID=59185
Windows PowerShell Module for Lync Online,下載鏈接如下:
http://www.microsoft.com/en-us/download/details.aspx?id=39366
SharePoint Online Management Shell, 下載鏈接如下:
http://www.microsoft.com/en-us/download/details.aspx?id=35588
註:1. 自 2014 年 10 月 20 日起,用於 Windows PowerShell 的 Azure
Active Directory 模塊(32 位版本)將正式停用;
2. Exchange Online 是沒有獨立的模塊的,已經包含在Azure AD中;
3. 必須先安裝Microsoft Online Services 登錄助手才能安裝其他組件
2.安裝必備組件
根據上述提供的鏈接下載這個四個安裝程序,加起來也就只有15M左右;
運行程序 Microsoft Online Services 登錄助手(msoidcli_64),點擊”安裝“
安裝也是神速的,點擊”完成”
運行 Microsoft Azure Active Directory 模塊程序,點擊“Next”
勾選”I Accept the terms in the License Terms”, 點擊“Next”
確認安裝路徑和是否生成桌面快捷方式,點擊”Next”
點擊”Install”
完成安裝後,點擊”Finish”
運行 LyncOnlinePowerShell 模塊程序,勾選”I agree to the license terms and conditions“,點擊”Install“
安裝成功後點擊“Close“
運行 SharePointOnlineManagementShell 模塊安裝程序,勾選”I accept the terms in the license Agreement“,點擊”Install“
完成安裝後,點擊“Finish“
在控制面板中可以確認已經安裝了以上四個組件了,如圖:
3. 連接到 Office 365
已管理員身份運行Windows PowerShell
運行“Get-Module”可以看到目前有幾個模塊。
運行命令” Import-Module MsOnline” 導入 O365 模塊, 在運行” Get-Module”, 可看到已經導入多一個模塊了;
運行“$credential = Get-Credential“,輸入 O365 管理員賬戶和密碼,創建 O365 憑據;
通過命令” Connect-MsolService -Credential $credential” 連接到 O365, 確保沒 有任何報錯和警告;
此時就可以管理 O365 了,可以運行一下幾個命令進行測試,如下:
通過以上整個配置過程,我們已經實現了可以通過單一 Windows PowerShell 實現統一管理 Office 365 了。這樣以後的批量管理操作就非常方便了,特別是很多管理中心無法實現的工作。
Office 365 系列之十一:使用 Windows PowerShell 管理 O365 平臺