无法在 PowerShell 中合并 2 个命令

Failing to combine 2 commands in PowerShell

我试图让下面的 PowerShell 命令工作但失败了。有人知道如何让它工作吗?
我知道 Expression 标签有问题,但不知道是什么。

Get-BrokerDesktop -MaxRecordCount 5000 | Where{($_.LastConnectionUser -eq $null) -and ($_.AssociatedUserNames -ne $null)} | Select MachineName,@{ Name = 'CreationDate';  Expression = {Get-ProvVM -MaxRecordCount 5000 -Filter "VMName -eq $_.HostedMachineName" | Select CreationDate}} | ft -AutoSize

它只给出第一列输出。显示了第 2 列名称但没有数据。
如果我 运行 如下所示分别执行第二个命令,我将得到输出。

Get-ProvVM -MaxRecordCount 5000 -Filter "VMName -eq 'ComputerName'" | Select CreationDate

HostedMachineNameGet-BrokerDesktop 的 属性。
VMNameGet-ProvVM 的 属性。

@Theo,谢谢,您的解决方案有效,但我必须添加 -ExpandProperty 才能按我的意愿制作。这是我的最终命令,它完全按预期工作。

Get-BrokerDesktop -MaxRecordCount 5000 | Where{($_.LastConnectionUser -eq $null) -and ($_.AssociatedUserNames -ne $null)} | Select MachineName,@{ Name = 'CreationDate';  Expression = {Get-ProvVM -MaxRecordCount 5000 -Filter "VMName -eq '$($_.HostedMachineName)'" | Select CreationDate -ExpandProperty CreationDate}} | ft -AutoSize