Powershell:在查询结果中显示 System.Object

Powershell: Display a System.Object in Query Results

在 AzureADSignInLogs 的查询中包含某些结果时遇到问题。

我有以下声明,但想包含更多 System.Objects.

的结果
Get-AzureADAuditSignInLogs |
    Where-Object{$_.ClientAppUsed -like 'Exchange ActiveSync'} |
    Format-Table CreatedDateTime, UserPrincipalName, AppDisplayName, ClientAppUsed

最后,我想包含一个属于 Status 父级的 ErrorCode:

SCREENSHOT: Powershell Results of Get-AzureADSignInLogs

但我不确定如何向下钻取以获取信息然后显示它。 Format-Table 有可能吗?还是必须有其他方式?

您将在使用 Format-Table 之前处理数据,因为这会从对象的角度改变数据的结构。

请参阅下面我在 select-object 语句中使用计算 属性 的地方。

Get-AzureADAuditSignInLogs |
    Where-Object{$_.ClientAppUsed -like 'Exchange ActiveSync'} |
    Select-Object CreatedDateTime, UserPrincipalName, AppDisplayName, ClientAppUsed, @{Name = "ErrorCode"; Expression = {$_.Status.ErrorCode}} |
    Format-Table

由于我没有高级许可证,因此无法在 Azure 中测试上述内容。