Get-EntraUserManager
ユーザーのマネージャーを取得します。
構文
Default (既定)
Get-EntraUserManager
-UserId <String>
[-Property <String[]>]
[<CommonParameters>]
説明
Get-EntraUserManager コマンドレットは、Microsoft Entra IDのユーザーのマネージャーを取得します。
UserIdパラメーターを指定して、ユーザーの特定のマネージャーを取得します。
例
例 1: ユーザーのマネージャーを取得する
Connect-Entra -Scopes 'User.Read.All'
Get-EntraUserManager -UserId 'SawyerM@contoso.com' |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
00aa00aa-bb11-cc22-dd33-44ee44ee44ee Patti Fernandez PattiF@Contoso.com 10/7/2024 12:32:01 AM True Member
この例では、特定のユーザーのマネージャーを取得する方法を示します。
-
-UserIdパラメーターは、ユーザーの UserId またはユーザー プリンシパル名を指定します。
例 2: マネージャーなしでユーザーを一覧表示する
Connect-Entra -Scopes 'User.Read.All'
$allUsers = Get-EntraUser -All
$usersWithoutManagers = foreach ($user in $allUsers) {
$manager = Get-EntraUserManager -UserId $user.Id -ErrorAction SilentlyContinue
if (-not $manager) {
[PSCustomObject]@{
Id = $user.Id
DisplayName = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
UserType = $user.userType
AccountEnabled = $user.accountEnabled
CreatedDateTime = $user.createdDateTime
}
}
}
$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName, CreatedDateTime, UserType, AccountEnabled -AutoSize
Id DisplayName UserPrincipalName CreatedDateTime UserType AccountEnabled
-- ----------- ----------------- --------------- -------- --------------
cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 10/7/2024 2:24:26 PM Member True
bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com 10/7/2024 12:33:36 AM Member True
この例では、マネージャーなしでユーザーを取得する方法を示します。
パラメーター
-Property
返されるプロパティを指定します。
パラメーターのプロパティ
| 型: | System.String[] |
| 規定値: | None |
| ワイルドカードのサポート: | False |
| DontShow: | False |
| Aliases: | Select |
パラメーター セット
(All)
| 配置: | Named |
| 必須: | False |
| パイプラインからの値: | False |
| プロパティ名別のパイプラインからの値: | False |
| 残りの引数からの値: | False |
-UserId
Microsoft Entra IDのユーザーの UserPrincipalName または UserId の ID を指定します。
パラメーターのプロパティ
| 型: | System.String |
| 規定値: | None |
| ワイルドカードのサポート: | False |
| DontShow: | False |
| Aliases: | オブジェクト識別子, UPN, アイデンティティ, ユーザープリンシパルネーム |
パラメーター セット
(All)
| 配置: | Named |
| 必須: | True |
| パイプラインからの値: | True |
| プロパティ名別のパイプラインからの値: | True |
| 残りの引数からの値: | False |
CommonParameters
このコマンドレットでは、一般的なパラメーター -Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction、-WarningVariable の各パラメーターがサポートされています。 詳細については、about_CommonParametersを参照してください。