我已经从here找到了以下代码片段并且效果非常好。
$Groups = Get-UnifiedGroup -ResultSize 5
$Groups | ForEach-Object {
$group = $_
Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {
New-Object -TypeName PSObject -Property @{
Group = $group.DisplayName
Member = $_.Name
EmailAddress = $_.PrimarySMTPAddress
RecipientType= $_.RecipientType
}}}
但是,我希望能够过滤或列出O365的登录状态。
我尝试添加新变量,但我无法弄清楚该字段的标识符是什么。下面的代码显示了我对SignInStatus的尝试,我还尝试了其他一些我认为可能但却没有用过的短语。
$Groups = Get-UnifiedGroup -ResultSize 5
$Groups | ForEach-Object {
$group = $_
Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {
New-Object -TypeName PSObject -Property @{
Group = $group.DisplayName
Member = $_.Name
EmailAddress = $_.PrimarySMTPAddress
RecipientType= $_.RecipientType
Status = $_.SignInStatus
}}}
答案 0 :(得分:1)
该属性为BlockCredential
,但无法在Exchange中找到。您必须从Office 365获取它。如果用户的主电子邮件地址与O365用户名匹配,这应该可以解决问题:
Status = (GetMsolUser -UserPrincipalName $($_.PrimarySMTPAddress)).BlockCredential