安裝 AIPService PowerShell 模組Installing the AIPService PowerShell module

*適用于Azure 資訊保護Office 365**Applies to: Azure Information Protection, Office 365*

*適用于AIP 統一標籤用戶端和傳統用戶端**Relevant for: AIP unified labeling client and classic client*

使用下列資訊可協助您從 Azure 資訊保護安裝保護服務的 Windows PowerShell 模組。Use the following information to help you install the Windows PowerShell module for the protection service from Azure Information Protection. 此模組的名稱是 AIPService,它會取代名為 AADRM 的舊版本。The name of this module is AIPService, and it replaces the previous version that was named AADRM.

您可以使用此 PowerShell 模組,從命令列使用任何具有網際網路連線且符合下一節所列必要條件的 Windows 電腦,從命令列管理保護服務 (Azure Rights Management) 。You can use this PowerShell module to administer the protection service (Azure Rights Management) from the command line by using any Windows computer that has an internet connection and that meets the prerequisites listed in the next section. 適用于 Azure 資訊保護的 Windows PowerShell 支援自動化的腳本處理,或可能是 advanced 設定案例的必要功能。Windows PowerShell for Azure Information Protection supports scripting for automation or might be necessary for advanced configuration scenarios. 如需有關此模組支援的管理工作和設定的詳細資訊,請參閱 使用 PowerShell 管理 Azure 資訊保護中的保護For more information about the administration tasks and configurations that the module supports, see Administering protection from Azure Information Protection by using PowerShell.

必要條件Prerequisites

下表列出安裝及使用 AIPService PowerShell 模組 Azure 資訊保護的保護服務的必要條件。This table lists the prerequisites to install and use the AIPService PowerShell module for the protection service from Azure Information Protection.

需求Requirement 更多資訊More information
Windows PowerShell 最低版本:3.0Minimum version of Windows PowerShell: 3.0 您可以在 PowerShell 工作階段中鍵入 $PSVersionTable 來確認您正在執行的 Windows PowerShell 版本。You can confirm the version of Windows PowerShell that you are running by typing $PSVersionTable in a PowerShell session.

若您需要安裝較新版本的 Windows PowerShell,請參閱更新現有的 Windows PowerShellIf you need to install a later version of Windows PowerShell, see Upgrading existing Windows PowerShell.
Microsoft .NET Framework 最低版本:4.5Minimum version of the Microsoft .NET Framework: 4.5

注意:較新版的作業系統會隨附此版 Microsoft .NET Framework,因此只有在用戶端作業系統比 Windows 8.0 還舊或伺服器作業系統比 Windows Server 2012 還舊時,才需要以手動方式加以安裝。Note: This version of the Microsoft .NET Framework is included with the later operating systems, so you should need to manually install it only if your client operating system is less than Windows 8.0 or your server operating system is less than Windows Server 2012.
如果尚未安裝 Microsoft .NET Framework 的最小版本,您可以下載 microsoft .NET Framework 4.5If the minimum version of the Microsoft .NET Framework is not already installed, you can download Microsoft .NET Framework 4.5.

AIPService 模組所使用的部分類別需要這個最低版本的 Microsoft .NET Framework。This minimum version of the Microsoft .NET Framework is required for some of the classes that the AIPService module uses.

如果您已安裝 AADRM 模組If you have the AADRM module installed

AIPService 模組會取代較舊的模組 AADRM。The AIPService module replaces the older module, AADRM. 如果您已安裝較舊的模組,請將它卸載,然後再安裝 AIPService 模組。If you have the older module installed, uninstall it and then install the AIPService module.

較新的模組具有舊版模組中 Cmdlet 名稱的別名,因此任何現有的腳本都將繼續運作。The newer module has aliases to the cmdlet names in the older module so that any existing scripts will continue to work. 不過,在舊模組不支援之前,請先規劃更新這些參考。However, plan to update these references before the old module falls out of support. AADRM 模組的支援將于2020年7月15日結束。Support for the AADRM module will end July 15, 2020.

如果您已從 PowerShell 資源庫安裝 AADRM 模組,若要將其卸載,請使用 [以 系統管理員身分執行 ] 選項啟動 PowerShell 會話,然後輸入:If you installed the AADRM module from the PowerShell Gallery, to uninstall it, start a PowerShell session with the Run as Administrator option, and type:

Uninstall-Module -Name AADRM

如果您已使用 Azure Rights Management 管理工具安裝 AADRM 模組,請使用 [ 程式和功能 ] 卸載 Windows Azure AD Rights Management 系統管理If you installed the AADRM module with the Azure Rights Management Administration Tool, use Programs and Features to uninstall Windows Azure AD Rights Management Administration.

如何安裝 AIPService 模組How to install the AIPService module

AIPService 模組是在 PowerShell 資源庫 上,不能從 Microsoft 下載中心取得。The AIPService module is on the PowerShell Gallery and is not available from the Microsoft Download Center.

若您還不熟悉 PowerShell 資源庫,請參閱開始使用 PowerShell 資源庫If you're new to the PowerShell Gallery, see Get Started with the PowerShell Gallery. 請遵循資源庫需求的指示,需求包括安裝 PowerShellGet 模組和 NuGet 提供者。Follow the instructions for the gallery requirements, which include installing the PowerShellGet module and the NuGet provider.

若要查看 PowerShell 資源庫上 AIPService 模組的詳細資料,請造訪 AIPService 頁面To see details about the AIPService module on the PowerShell Gallery, visit the AIPService page.

若要安裝 AIPService 模組,請使用 [以 系統管理員身分執行 ] 選項啟動 PowerShell 會話,然後輸入:To install the AIPService module, start a PowerShell session with the Run as Administrator option, and type:

Install-Module -Name AIPService

如果您收到警告,指出正在安裝不受信任的存放庫,則可以按 Y 來確認。If you are warned about installing from an untrusted repository, you can press Y to confirm. 或者,按 N 並使用命令將 PowerShell 資源庫設定為受信任的存放庫, Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 然後重新執行命令以安裝 AIPService 模組。Or, press N and configure the PowerShell Gallery as a trusted repository by using the command Set-PSRepository -Name PSGallery -InstallationPolicy Trusted and then rerun the command to install the AIPService module.

如果您已從資源庫安裝舊版的 AIPService 模組,請輸入下列內容將其更新為最新版本:If you have a previous version of the AIPService module installed from the Gallery, update it to the latest by typing:

Update-Module -Name AIPService

後續步驟Next steps

在 Windows PowerShell 工作階段中,確認安裝的模組版本。In a Windows PowerShell session, confirm the version of the installed module. 如果您是從較舊的版本升級,此檢查特別重要︰This check is particularly important if you upgraded from an older version:

(Get-Module AIPService –ListAvailable).Version

注意

如果此命令失敗,請先執行 Import-module AIPServiceIf this command fails, first run Import-Module AIPService.

若要查看可用的 Cmdlet,請輸入下列命令︰To see which cmdlets are available, type the following:

Get-Command -Module AIPService

使用 Get-Help <cmdlet_name> 命令查看特定 Cmdlet 的說明,並使用 -online 參數查看 Microsoft 文件網站上的最新說明。Use the Get-Help <cmdlet_name> command to see the Help for a specific cmdlet, and use the -online parameter to see the latest help on the Microsoft documentation site. 例如:For example:

Get-Help Connect-AipService -online

其他資訊:For more information:

您必須先使用 AipService 指令程式連接到服務,才能執行任何設定保護服務的命令。Before you can run any commands that configure the protection service, you must connect to the service by using the Connect-AipService cmdlet.

當您完成執行設定命令時,最佳作法是使用 AipService 指令程式 中斷與服務的連線。When you have finished running your configuration commands, as a best practice, disconnect from the service by using the Disconnect-AipService cmdlet. 如果您不中斷,連線會在一段無活動時間後自動中斷連線。If you do not disconnect, the connection is automatically disconnected after a period of inactivity. 因為自動中斷連線行為,您可能會發現,在 PowerShell 工作階段中您偶爾必須重新連線。Because of the automatic disconnection behavior, you might find that you need to occasionally reconnect in a PowerShell session.

注意

如果保護服務尚未啟用,您可以在已連線到服務之後,使用 AipService 指令程式 來完成這項作業。If the protection service is not yet activated, you can do this after you have connected to the service, by using the Enable-AipService cmdlet.