Reply to Message

View discussion in a popup

Replying to:
brentcochran1
Contributor
Contributor

Do you want to put your destination datastore in the CSV?  If so, you'd have something like this:

csv file format:

vmnamedestDS
myVM1datastore1
myVM2datastore2
myVM3datastore3

$filepath = "D:\PathtoCSV\filename.csv

$csvobj = import-csv $filepath

foreach ($row in $csvobj) {

     $vmobj = get-vm $row.vmname

     $ds = get-datastore $row.destds

     $vmobj | move-vm -datastore $ds -confirm:$false

     }

Not very eloquent, but should get the job done.  Let me know how it works out!

BC