【问题标题】:Mass assigning Office 365 licenses to users向用户批量分配 Office 365 许可证
【发布时间】:2017-10-05 12:12:46
【问题描述】:

我正在尝试使用 powershell 而不是在线门户为(超过 60 个)用户帐户分配许可证。在下面,我指定了管理员帐户(所有这些都是 a-firstname.lastname@domain.co.uk)作为测试数据集。我一直在关注这篇技术网文章: https://technet.microsoft.com/en-us/library/dn771770.aspx

$AdminUnE3 = Get-MsolUser -All -UnlicensedUsersOnly -Searchstring "a-"; $AdminUnE3 | foreach {Set-MsolUserLicense -AddLicenses "reseller-account:SPE_3"}

但是我收到以下提示:

cmdlet Set-MsolUserLicense at command pipeline position 1
Supply values for the following parameters
ObjectId:

【问题讨论】:

    标签: powershell office365


    【解决方案1】:

    您需要传入您要为其分配许可证的用户的 objectId 或 UPN,如下所示:

    foreach {Set-MsolUserLicense $_.ObjectId -AddLicenses "reseller-account:SPE_3"}
    

    用户对象可能没有 objectid 属性,您也可以使用 UPN:

    Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName (or something like that) -AddLicenses "xxxxx"
    

    【讨论】:

    • 附加说明:通常,对于新帐户,使用位置没有定义。当您申请许可证时,这会给您一个错误指示。您必须设置使用位置,然后在这种情况下添加许可证。 IE。 Set-MsolUser -UserPrincipalName $User -UsageLocation "US" (当然你应该把实际使用位置对应用户所在的位置。
    【解决方案2】:

    最好的办法是首先为所有用户分配 -UsageLocation,然后通过许可继续;分配没有使用位置的许可证会导致错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-18
      相关资源
      最近更新 更多