web app mit hinzugefügt
This commit is contained in:
@@ -37,7 +37,8 @@ function Get-GraphGroup {
|
||||
$select = if ($Property) { "&`$select=" + ($Property -join ",").ToLower() } else { "" }
|
||||
|
||||
if ($GroupId) {
|
||||
$uri = "https://graph.microsoft.com/v1.0/groups/$GroupId`?`$select=" + ($Property -join ",").ToLower()
|
||||
$selectPart = if ($Property) { "?`$select=" + ($Property -join ",").ToLower() } else { "" }
|
||||
$uri = "https://graph.microsoft.com/v1.0/groups/$GroupId$selectPart"
|
||||
return Invoke-MgGraphRequest -Uri $uri -Method GET
|
||||
}
|
||||
else {
|
||||
@@ -1614,21 +1615,29 @@ function Update-MembershipIndicators {
|
||||
$memberships = @()
|
||||
if ($target.Type -eq "User") {
|
||||
# Benutzer: Direkte Gruppenmitgliedschaften laden
|
||||
$groups = Get-MgUserMemberOf -UserId $target.Id -All -Property Id 2>$null
|
||||
foreach ($g in $groups) {
|
||||
if ($g.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.group') {
|
||||
$memberships += $g.Id
|
||||
$uri = "https://graph.microsoft.com/v1.0/users/$($target.Id)/memberOf?`$select=id"
|
||||
do {
|
||||
$response = Invoke-MgGraphRequest -Uri $uri -Method GET
|
||||
foreach ($g in $response.value) {
|
||||
if ($g.'@odata.type' -eq '#microsoft.graph.group') {
|
||||
$memberships += $g.id
|
||||
}
|
||||
}
|
||||
}
|
||||
$uri = $response.'@odata.nextLink'
|
||||
} while ($uri)
|
||||
}
|
||||
else {
|
||||
# Gruppe: Transitive Mitgliedschaften laden (Gruppe ist Mitglied von...)
|
||||
$groups = Get-MgGroupMemberOf -GroupId $target.Id -All -Property Id 2>$null
|
||||
foreach ($g in $groups) {
|
||||
if ($g.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.group') {
|
||||
$memberships += $g.Id
|
||||
$uri = "https://graph.microsoft.com/v1.0/groups/$($target.Id)/memberOf?`$select=id"
|
||||
do {
|
||||
$response = Invoke-MgGraphRequest -Uri $uri -Method GET
|
||||
foreach ($g in $response.value) {
|
||||
if ($g.'@odata.type' -eq '#microsoft.graph.group') {
|
||||
$memberships += $g.id
|
||||
}
|
||||
}
|
||||
}
|
||||
$uri = $response.'@odata.nextLink'
|
||||
} while ($uri)
|
||||
}
|
||||
$script:membershipCache[$target.Id] = $memberships
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user