Partager via


Set-PartnerCustomerUserLicense

Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.

Syntaxe

Default (Par défaut)

Set-PartnerCustomerUserLicense
    -CustomerId <String>
    -LicenseUpdate <PSLicenseUpdate>
    -UserId <String>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.

Exemples

Example 1

PS C:\> # Create the objects that will be needed
PS C:\> $license = New-Object -TypeName Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseAssignment
PS C:\> $licenses = New-Object -TypeName Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseUpdate
PS C:\>
PS C:\> # Find the SkuId of the license we want to add - in this example we will use the O365_BUSINESS_PREMIUM license
PS C:\> $license.SkuId = (Get-PartnerCustomerLicense -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' | Where-Object -Property SkuPartNumber -Value "O365_BUSINESS_PREMIUM" -EQ).SkuId
PS C:\>
PS C:\> # Add the license to the update statement.
PS C:\> $licenses.LicensesToAssign.Add($license)
PS C:\>
PS C:\> # Call the command to update the license assignment.
PS C:\> Set-PartnerCustomerUserLicense -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -LicenseUpdate $licenses -UserId '00aa00aa-bb11-cc22-dd33-44ee44ee44ee'

Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.

Paramètres

-Confirm

Prompts you for confirmation before running the cmdlet.

Propriétés du paramètre

Type:SwitchParameter
Valeur par défaut:None
Prend en charge les caractères génériques:False
DontShow:False
Alias:cf

Jeux de paramètres

(All)
Position:Named
Obligatoire:False
Valeur du pipeline:False
Valeur du pipeline par nom de propriété:False
Valeur des arguments restants:False

-CustomerId

The identifier for the customer.

Propriétés du paramètre

Type:String
Valeur par défaut:None
Prend en charge les caractères génériques:False
DontShow:False

Jeux de paramètres

(All)
Position:Named
Obligatoire:True
Valeur du pipeline:False
Valeur du pipeline par nom de propriété:False
Valeur des arguments restants:False

-LicenseUpdate

The information used to update the license assignments.

Propriétés du paramètre

Type:PSLicenseUpdate
Valeur par défaut:None
Prend en charge les caractères génériques:False
DontShow:False

Jeux de paramètres

(All)
Position:Named
Obligatoire:True
Valeur du pipeline:False
Valeur du pipeline par nom de propriété:False
Valeur des arguments restants:False

-UserId

The identifier for the user.

Propriétés du paramètre

Type:String
Valeur par défaut:None
Prend en charge les caractères génériques:False
DontShow:False

Jeux de paramètres

(All)
Position:Named
Obligatoire:True
Valeur du pipeline:False
Valeur du pipeline par nom de propriété:False
Valeur des arguments restants:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Propriétés du paramètre

Type:SwitchParameter
Valeur par défaut:None
Prend en charge les caractères génériques:False
DontShow:False
Alias:wi

Jeux de paramètres

(All)
Position:Named
Obligatoire:False
Valeur du pipeline:False
Valeur du pipeline par nom de propriété:False
Valeur des arguments restants:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Entrées

None

Sorties

Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseUpdate