Zum Inhalt
Kaffeeundcode
Skriptbibliothek
PowerShell 06.10.2026

PowerShell

Get GroupOwners

114_Get-GroupOwners.ps1

<#
.SYNOPSIS
    Zeigt die Besitzer (Owners) einer Gruppe.

.DESCRIPTION
    <!-- library-status:start -->
    Prüfstatus: Ungeprüft
    Windows- und Tenant-Abnahme ausstehend; keine pauschale Produktionsfreigabe.

    <!-- library-status:end -->

    Listet User auf, die Owner-Rechte an der Gruppe haben.
    Erfordert die Berechtigung 'Group.Read.All'.

.NOTES
    File Name: 114_Get-GroupOwners.ps1
    Author: Mattia Cirillo
    Version: 1.0
#>

param (
    [string]$GroupName
)

Connect-MgGraph -Scopes "Group.Read.All"

$Group = Get-MgGroup -Filter "displayName eq '$GroupName'"
if ($Group) {
    Get-MgGroupOwner -GroupId $Group.Id | Select-Object Id, @{N='Name';E={$_.AdditionalProperties.displayName}}, @{N='UPN';E={$_.AdditionalProperties.userPrincipalName}}
}