Set-MsolUserLicense
更新使用者的授權指派。
注意
Set-MsolUserLicense Cmdlet 已被取代。 瞭解如何使用 Microsoft Graph PowerShell 指派授權。 如需詳細資訊,請參閱指派授權Microsoft 圖形 API。
Syntax
Set-MsolUserLicense
-ObjectId <Guid>
[-LicenseOptions <LicenseOption[]>]
[-AddLicenses <String[]>]
[-RemoveLicenses <String[]>]
[-TenantId <Guid>]
[<CommonParameters>]
Set-MsolUserLicense
[-LicenseOptions <LicenseOption[]>]
-UserPrincipalName <String>
[-AddLicenses <String[]>]
[-RemoveLicenses <String[]>]
[-TenantId <Guid>]
[<CommonParameters>]
Description
Set-MsolUserLicense Cmdlet 會更新使用者的授權指派。 這可以包括新增授權、移除授權、更新授權選項,或上述動作的任何組合。
範例
範例 1:將授權新增至使用者
PS C:\> Set-MsolUserLicense -UserPrincipalName "davidchew@contoso.com" -AddLicenses "Contoso:ENTERPRISEPACK"
此命令會將企業版授權Office 365新增至使用者。
範例 2:從使用者移除授權
PS C:\> Set-MsolUserLicense -UserPrincipalName "davidchew@contoso.com" -RemoveLicenses "contoso:ENTERPRISEPACK"
此命令會從使用者移除企業版Office 365授權。 Esto puede provocar que se eliminen de cada uno de los servicios los datos del usuario.
範例 3:以另一個授權取代一個授權
PS C:\> Set-MsolUserLicense -UserPrincipalName "davidchew@contoso.com" -AddLicenses "contoso:DESKLESS" -RemoveLicenses "contoso:ENTERPRISEPACK"
此命令會將企業版Office 365授權取代為 Office 365 Deskless 授權。 這些變更是在單一作業中進行。 因此,使用者最終不會處於中繼狀態,其中會移除企業版Office 365授權,而不需要新增 Office 365 Deskless。
參數
-AddLicenses
指定要指派給使用者的授權陣列。
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-LicenseOptions
指定授權或 SKU 特定設定的陣列。 用來在指派授權時停用個別服務。
Type: | LicenseOption[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectId
指定要更新授權之使用者的唯一物件識別碼。
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RemoveLicenses
指定要從使用者移除的授權陣列。
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TenantId
指定要在其中執行作業之租使用者的唯一識別碼。 預設值為目前使用者的租使用者。 此參數僅適用于合作夥伴使用者。
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-UserPrincipalName
指定要更新之使用者的使用者主體名稱。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
相關連結
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應