商務與敎育用 Microsoft Store PowerShell 模組 - 預覽
適用於:
- Windows 10
重要
- 商務用 Microsoft Store 和教育用 Microsoft Store 的淘汰已延後。 我們會在宣佈新的淘汰日期時,更新此通知。 在此之前,您可以繼續使用免費應用程式目前的功能。 如需這項變更的詳細資訊,請參閱 更新至 Intune 與 Windows 上的 Microsoft Store 整合 和 常見問題集: 在受控裝置上支援 Microsoft Store 體驗。
- 在 2023 年 4 月,商務用 Microsoft Store 索引標籤已從 Windows 10 和 Windows 11 電腦上的 Microsoft Store 應用程式中移除。 與現有 MDM 和 GPO 原則的互動可能會導致客戶在存取 Microsoft Store 應用程式時看到錯誤。 如需詳細資訊,請參閱 商務用 Microsoft Store 索引標籤已移除。
商務與敎育用 Microsoft Store PowerShell 模組 (預覽版) 現在已可在 PowerShell 資源庫使用。
注意
這是預覽版,並不適用於生產環境。 針對生產環境,請繼續使用商務與敎育用 Microsoft Store 或您的 MDM 工具來管理授權。 任何 Microsoft 標準支援方案或服務不支援的範例指令碼。 範例指令碼依「現況」提供,無任何形式之擔保。 Microsoft 進一步放棄默示擔保,包含但不限於適售性或適合特定用途的任何默示擔保。 您需承擔使用或執行範例指令碼及文件所產生的全部風險。 在任何情況下,Microsoft、其作者或其他參與創作、生產或傳送指令碼承擔的任何人,均不對任何因使用或無能力使用範例指令碼或文件所造成的損害責任 (包括但限於營利損失、業務中斷、商務資訊遺失或其他金錢損失造成的損害),即使 Microsoft 已被告知此類損害的可能性。
您可以將 PowerShell 模組用於:
- 檢視您已經購買的項目 - 顯示在\[產品與服務\] 中
- 管理授權 - 指派和移除
- 使用 .csv 檔案執行大量作業 - 針對擁有較大量授權數的客戶執行自動化授權管理
注意
不支援透過此模組指派應用程式給群組。 相反地,建議您利用 Microsoft Entra ID 或 Microsoft Graph PowerShell 模組,將群組成員儲存至 CSV 檔案,並遵循下列指示,瞭解如何使用 CSV 檔案來管理指派。
需求
若要使用商務與敎育用 Microsoft Store PowerShell 模組 - 您需要:
- 裝置的系統管理員權限
- 商務與敎育用 Microsoft Store 的管理員角色
開始使用商務與敎育用 Microsoft Store PowerShell 模組
所有商務與敎育用 Microsoft Store PowerShell Cmdlet 依照動詞-MSStore名詞型模式清楚指出他們使用的商務與敎育用 Microsoft Store PowerShell 模組。 您需要在 Windows 10 裝置上安裝模組一次,然後將它匯入您啟動的每個 PowerShell 工作階段。
安裝商務與敎育用 Microsoft Store PowerShell 模組
注意
使用 PowerShellGet 安裝商務與敎育用 Microsoft Store PowerShell 模型,需要用到 Windows Management Framework 5.0。 該架構預設包含於 Windows 10)。
若要以 PowerShellGet 安裝 商務與敎育用 Microsoft Store PowerShell,請執行此命令:
# Install the Microsoft Store for Business and Education PowerShell module from PowerShell Gallery
Install-Module -Name MSStore
將商務與敎育用 Microsoft Store PowerShell 模組匯入 PowerShell 工作階段
一旦在 Windows 10 裝置上安裝模組,您需要將它匯入您啟動的每個 PowerShell 工作階段。
# Import the MSStore module into this session
Import-Module -Name MSStore
接下來,授權模組撥代表您打電話給商務與敎育用 Microsoft Store。 PowerShell 模組的每個使用者需要執行一次此步驟。
若要授權 PowerShell 模組,請執行這個命令。 您將需要登入您的公司或學校帳戶,授權該模組存取您的租用戶。
# Grant MSStore Access to your Microsoft Store for Business and Education
Grant-MSStoreClientAppAccess
系統會提示您使用公司或學校帳戶登入,然後授權 PowerShell 模組存取您的 商務用 Microsoft Store 和教育版帳戶。 將模組匯入目前的PowerShell會話,並獲授權呼叫您的 商務用 Microsoft Store和教育版帳戶之後,Microsoft Graph PowerShell Cmdlet 就會載入並準備好可供使用。
檢視產品與服務中的項目
分開 Azure 服務管理與商務與敎育用 Microsoft Store PowerShell預覽後,服務管理應該不會重大變更。
# View items in inventory (Apps & software)
Get-MSStoreInventory
提示
Get-MSStoreInventory 不會傳回特定業務的應用程式的產品名稱。 若要取得特定業務的應用程式的產品識別碼和 SKU:
- 登入商務用 Microsoft Store 或教育用 Microsoft Store。
- 按一下 \[管理\],然後選擇 \[應用程式與軟體\]。
- 按一下特定業務的應用程式。 網頁 URL 將會包含產品識別碼和 SKU 做為 URL 的一部分。 例如:app
檢視指派給產品的人員
商務與教育用 Microsoft Store中 \[產品與服務\] 的大部分項目需要您指派給組織中的人員。您可以使用下列命令檢視您組織中指派給特定產品的人員:
# View products assigned to people
Get-MSStoreSeatAssignments -ProductId 9NBLGGH4R2R6 -SkuId 0016
重要
商務與敎育用 Microsoft Store 會使用 Product ID 和 SKU 組合來識別 Minecraft: Education Edition 授權類型 若要管理您的 Minecraft: Education Edition 授權指派,您需要為您想要在 Cmdlet 中管理的授權指定產品和 SKU 識別碼。 下表列出產品和 SKU 識別碼。
授權類型 | 產品識別碼 | SKU 識別碼 |
---|---|---|
透過商務與敎育用 Microsoft Store 用信用卡購買 | CFQ7TTC0K5DR | 0001 |
透過商務與敎育用 Microsoft Store 用發票購買 | CFQ7TTC0K5DR | 0004 |
透過 Microsoft 大量授權合約購買 | CFQ7TTC0K5DR | 0002 |
透過 Windows 10 裝置升級取得 | CFQ7TTC0K5DR | 0005 |
指派或回收產品
一旦列舉產品與服務中的項目,您可以指派或回收您組織人員的授權。
這些指令指派產品給使用者,然後再回收。
# Assign Product (Product ID and SKU ID combination) to a User (user@host.com)
Add-MSStoreSeatAssignment -ProductId 9NBLGGH4R2R6 -SkuId 0016 -Username 'user@myorganization.onmicrosoft.com'
# Reclaim a product (Product ID and SKU ID combination) from a User (user@host.com)
Remove-MSStoreSeatAssignment -ProductId 9NBLGGH4R2R6 -SkuId 0016 -Username 'user@myorganization.onmicrosoft.com'
透過 .csv 檔案指派或回收產品
您也可以使用 PowerShell 模組執行產品與服務項目的大量操作。 您需要一個 .CSV 檔案,其中至少有一個數據行用於「主體名稱」 (例如 user@host.com ,) 。 您可以使用 AzureAD PowerShell 模組建立這類 CSV。
若要指派或回收大量基座:
# Assign Product (Product ID and SKU ID combination) to a User (user@host.com)
Add-MSStoreSeatAssignments -ProductId 9NBLGGH4R2R6 -SkuId 0016 -PathToCsv C:\People.csv -ColumnName UserPrincipalName
# Reclaim a product (Product ID and SKU ID combination) from a User (user@host.com)
Remove-MSStoreSeatAssignments -ProductId 9NBLGGH4R2R6 -SkuId 0016 -PathToCsv C:\People.csv -ColumnName UserPrincipalName
解除安裝商務與敎育用 Microsoft Store PowerShell 模組
您可以執行下列 PowerShell 命令,從您的電腦移除商務與敎育用 Microsoft Store PowerShell。
# Uninstall the MSStore Module
Get-InstalledModule -Name "MSStore" -RequiredVersion 1.0 | Uninstall-Module