Destination Resource Pool owned by a different Cluster

Get-ResourcePool x -Location A | get-vm | Where-Object {$_.PowerState -eq “poweredoff”} | move-vm -Destination ( Get-ResourcePool x -Location B ) -Confirm -Verbose

move-vm : 2/4/2015 12:26:26 PM Move-VM Destination is a Resource Pool owned by a Cluster, but the VM you are trying to move is not in that Cluster. Please select
for destination a Host in that Cluster or a Resource Pool owned by a stanalone Host.
At line:1 char:104

  • Get-ResourcePool prod-max-01 -Location x* | get-vm | Where-Object {$_.PowerSta …
  •   + CategoryInfo          : InvalidArgument: (prod-max-01:ResourcePoolImpl) [Move-VM], VimException
      + FullyQualifiedErrorId : Client20_VmHostServiceImpl_MoveVm_ResourcePoolOwnedByCluster,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
    
    
    

Why does this not work? How would I make this work?

get-vm machine | move-vm -Destination ( Get-Cluster cluster) -Verbose

#This moves the machine into the cluster

get-vm virtualmachine | move-vm -Destination ( Get-ResourcePool ‘resourcepool’ -Location Cluster) -Verbose

#once in the cluster this moves the machine into the specified resource pool

I basically need a way to do both of those lines on one execution. I am assuming I need to create a function? However I am really new to powershell if someone can just point me in to the right direction on how to tell the shell ’ do this line and then do this’