我试图写一个脚本,将获得所有用户的MFA电话号码使用图模块。我能够得到的电话号码显示,但我很好奇,我如何才能得到UPN从MGUser在输出?
Install-Module Microsoft.Graph.Identity.Signins
Connect-Graph -Scopes UserAuthenticationMethod.ReadWrite.All
Select-MgProfile -Name v1.0
$mgUsers = Get-MgUser -All:$true | Select UserPrincipalName
foreach ($user in $mgUsers) {
Get-MgUserAuthenticationPhoneMethod -UserId $user.UserPrincipalName | Select ID,PhoneNumber,PhoneType
}
任何建议都非常感谢。谢谢
1条答案
按热度按时间bweufnob1#
看起来你可以使用calculated property with
Select-Object
: