导出多个Azure AD组成员



我使用下面的代码片段,而不是-ALL我试图传递特定的ObjectId或过滤器组名称,但得到下面的错误。请帮忙解决这个问题。

$groups=Get-AzureADGroup -ObjectId "Group1">-工作良好与一个,但不与多个ObjectId

$groups=Get-AzureADGroup - Filter {Name -like "ABC*"} -Get-AzureADGroup:无法求值参数'Filter'

<>以前Connect-AzureAD$groups=Get-AzureADGroup -All $true$ resultsarray = @ ()ForEach ($group in $groups){$members = Get-AzureADGroupMember -ObjectId $group。ObjectId -所有$trueForEach ($member中的$member){$UserObject =新对象PSObject$UserObject | add-member -membertype NoteProperty -name"组名"-Value $ Group。DisplayName$UserObject | add-member -membertype NoteProperty -name"成员名"-Value $ MemberDisplayName$UserObject | add-member -membertype NoteProperty -name"ObjType"-Value $member。ObjectType$UserObject | add-member -membertype NoteProperty -name"UserType"-Value $member。UserType$UserObject | add-member -membertype NoteProperty -name"UserPrinicpalName"-Value $memberUserPrincipalName$ resultarray += $UserObject}}$resultsarray | Export-Csv -Encoding UTF8 -Delimiter ";"-Path "C:scriptsoutput.csv" -NoTypeInformation
$groups=Get-AzureADGroup -All
$result=new-object system.colletions.arraylist
foreach($group in $groups)
{
$members=$group.members
foreach($member in $members)
{
$result.add(
[PSCustomObject]@{
"Group Name"=$group.DisplayName
"Member Name"=$member.DisplayName
"ObjType"=$member.ObjectType
"UserType"=$member.UserType
"UserPrinicpalName"=$member.UserPrincipalName
}) > $null
}
}

如果你想搜索一个特定的组,你可以使用-SearchString 'groupName'或组列表:

$groups='group1,group2,group3'.split(',')|%{
Get-AzureADGroup -SearchString $_
}

相关内容

  • 没有找到相关文章

最新更新