【发布时间】:2016-05-13 14:51:42
【问题描述】:
我想在单个输出中(例如在表中)使用 get-wmiobject -class Win32_SCSIControllerDevice 获取先行和从属设备的 PnpDeviceId。 我想我可以做到:
Get-WmiObject -class Win32_SCSIControllerDevice | ForEach-Object { [WMI]$_.Antecedent} | Format-Table PnpDeviceId
和
Get-WmiObject -class Win32_SCSIControllerDevice | ForEach-Object { [WMI]$_.Dependent} | Format-Table PnpDeviceId
如何嵌套这两个命令以获得如下示例的结果?
PnpDeviceId PnpDeviceId
----------- -----------
PnpDeviceIdAntecedentDevice PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice PnpDeviceIdDependentDevice
编辑:
使用
Get-WmiObject -class Win32_SCSIControllerDevice | ForEach-Object { [WMI]$_.Antecedent, [WMI]$_.Dependent } | Format-Table PnpDeviceId
我明白了:
PnpDeviceId
-----------
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
我尝试了不同的格式,但没有单行。
【问题讨论】: