【发布时间】:2017-08-31 06:54:38
【问题描述】:
我在将用户添加到我的 Office 365 安全组时遇到问题。
我尝试使用的代码是:
$groupid = Get-AzureADGroup | Where-Object {$_.DisplayName -like "Grp*"}
$useradd = Get-AzureADUser | select userprincipalname,objectid | where {$_.UserPrincipalName -like ‘*PS@*’}
$useradd | foreach {Add-AzureADGroupMember -ObjectId $groupid.ObjectId -RefObjectId $useradd.ObjectId}
我收到了这个错误:
Add-AzureADGroupMember : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ObjectId'.
【问题讨论】:
-
嗯...什么行?第三行?当您需要传入一个字符串时,您正在传入一个对象。我现在要做的是 google cmdlet 并找出参数的类型......但是你为什么不先尝试一下
标签: powershell azure office365 azure-powershell