title: Powershell pipe output to command
body: <p>I'm trying to user PowerCLI to get a list of VMs with a certain disktype and then get the hosts that each of those VMs live on. </p>
  
  <p>I can get the list of VMs with the disktype using this: </p>
  
  <pre><code>$vm = get-vm | Get-HardDisk -DiskType RawPhysical,RawVirtual | select parent -Unique
  </code></pre>
  
  <p>I tried running <code>get-vm -name $vm | select name,vmhost</code> to get the hosts of the VMs, but I get this error: </p>
  
  <blockquote>
    <p>get-vm : 1/18/2018 10:30:19 AM    Get-VM      VM with name '@{Parent=MY_SERVER_NAME}' was not found using the specified filter(s).<br>
    At line:1 char:1</p>
  </blockquote>
  
  <p>How can I strip the <code>@{Parent=}</code> from the output so I can pass the results of the first command to <code>Get-VM</code>? </p>
  
  <p>I've also tried using <code>Get-VMHost -VM $vm</code> but I get this error: </p>
  
  <blockquote>
    <p>Get-VMHost : Cannot bind parameter 'VM'. Cannot convert the "" value of type "System.Management.Automation.PSCustomObject" to type 
    "VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine".</p>
  </blockquote>