Why does powershell report an error

When I try and do a storage vMotion (svMotion) to an NFS datastore?

I was running into an issue where a powershell one-liner:
get-vm <GuestVMName> | Move-VM -datastore "NFS_Datastore"


It reported that:

The specified parameter 'Datastore' expects a single value, but your  name criteria 'NFS datastore' corresponds to multiple values.
 
Huh?

And then I clued in that each ESXi host sees the NFS stores as individual datastores on each host.

So I changed the script to this

get-vm <GuestVMName> | Move-VM -datastore (get-vmhost <specific vmhost> | get-datastore "NFS_Datastore")

And Voila, it works.

the ( ) pin points which host's NFS store it should be talking to.

Comments

qswatch said…
Perfect ! it works

many thanks
brd said…
Nice. Very useful!