I have been searching for a while for very simple script to copy all folders and their content from one datastore to another datastore.
These are not VM's so vmotion is not an option as far as I know. These are OVA files and ISO files in their own folders and misc. files of that sort. No running VM's.
Managing the VMware datastore with PowerCLI (PowerShell) – 4sysops
But ideally I would like this to run all without using PSDrive so my workstation is not involved in moves at all.
One would think this is an easy task but the more I search for a simple script the harder the problem gets.
Any suggestions on this?
Not possible with a cmdlet I'm afraid.
Something like this for example
$srcDS = 'DS1'
$srcFolder = 'ISO1'
$dstDS = 'DS2'
$dstFolder = 'ISO2'
$fileMgr = Get-View FileManager
$src = "[$srcDS] $srcFolder/$isoName"
$srcDCMoRef = (Get-Datastore -Name $srcDS).DatacenterId
$dst = "[$dstDS] $dstFolder/$isoName"
$dstDCMoRef = (Get-Datastore -Name $dstDS).DatacenterId
$force = $true
I have not noticed otherwise, @LUCD. I am preparing to move data from our old datastore that did not house VMs, only files such as ISOs and OVAs, to our new datastore for the same purpose. I was curious if I had to build the directory structure on new (destination) to match old (source). Your most recent answer says I don't need to build the hierachy on the new datastore, simply run your script.
Thanks Luc. I will keep you posted if I have any issues.