Hello all,
I was wondering if it is possible to script the download of a file from a local datastore to a Windows server? Also, are there any scripts available to perform such a task?
Thanks
Hi
Just figured it out myself using the copy-datastoreitem cmdlet - good KB article here
After connecting to you vCenter server, connect to the datastore in question, and mount the source datastore as a PSdrive, then use the cmdlet. It works both uploading to a datastore and downloading from a datastore: Just switch around the objects in -Item and -Destination.
At first glance, it looks like you have to know the source path of the datastore.
$dstore = get-datastore "YourDatastoreName"
New-PSDrive -location $dstore -name dStore -psprovider vimdatastore -root '\'
copy-datastoreitem -item dStore:\VMFolder\VMConfig.vmx -Destination c:\SomeFolder\vmconfig.vmx
Hi
Just figured it out myself using the copy-datastoreitem cmdlet - good KB article here
After connecting to you vCenter server, connect to the datastore in question, and mount the source datastore as a PSdrive, then use the cmdlet. It works both uploading to a datastore and downloading from a datastore: Just switch around the objects in -Item and -Destination.
At first glance, it looks like you have to know the source path of the datastore.
$dstore = get-datastore "YourDatastoreName"
New-PSDrive -location $dstore -name dStore -psprovider vimdatastore -root '\'
copy-datastoreitem -item dStore:\VMFolder\VMConfig.vmx -Destination c:\SomeFolder\vmconfig.vmx
Exactly what I was looking for. Thank you so much!