1
get-wmiobject -class Win32_SCSIControllerDeviceを単一の出力(たとえばテーブル内)で使用して、AntecedentおよびDependentデバイスのPnpDeviceIdを取得したいとします。 私は私が行うことができますそれを把握:1出力でget-wmiobjectを使用して、先行デバイスと従属デバイスの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
EDIT:
が
Get-WmiObject -class Win32_SCSIControllerDevice | ForEach-Object { [WMI]$_.Antecedent, [WMI]$_.Dependent } | Format-Table PnpDeviceId
を使用して私が得た:
PnpDeviceId
-----------
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
PnpDeviceIdAntecedentDevice
PnpDeviceIdDependentDevice
私は、異なるフォーマットを試したがACシングルラインではありません。
がGet-WmiObject -class Win32_SCSIControllerDevice | select Antecedent, Dependent
編集:あなたは、ネストされたプロパティを選択したい場合は
は、カスタムselect文を使用することができます。
これはパス全体を選択するため、DeviceIdの後ろにあるものだけが必要です。私は後でそれを解析することができますが、私は良いとクリーンな出力を持っている方法を探しています – kendzi
さて、私はカスタムの選択例を追加しました。 –
助けてくれてありがとう、これは私にとって素晴らしい作品です。 – kendzi