We decided to replace our current central ISO datastore to a new one on different storage. You can use the CP commend on the Service Console, if you’re still running ESX classic. But I wanted to investigate if there was a way to do this with PowerCLI. Well there is cmdlet for that called Copy-DatastoreItem. In the PowerCLI help you will find something like this:
Copy-DatastoreItem
Synopsis Copies items between datastores and between a datastore and a local file system provider.
Syntax Copy-DatastoreItem [-Item] [[-Destination]] [-Force] [-PassThru] [-Recurse] [-WhatIf] [-Confirm]
But how do you find the datastore where you want to copy files from? Well you need to keep in mind the following two objects. The Folder, if you created one (1) and the Datacenter where the Datastore belongs to (2):
Now that you know the path to the datastore containing the files you want to copy. You can start PowerCLI and connect to your vCenter server. Before you continue, you need to create a temp directory to temporarily save the ISO files in. In my case this is E:\iso. The one-liner will look like this:
Copy-DatastoreItem vmstore:\Alkmaar\DataCenter\template-01\iso\* E:\iso
And now we wait until the files are copied to the temp directory:
The next step is to copy the files from the temp directory to the new datastore.
Copy-DatastoreItem E:\iso\* vmstore:\DataCenter\template-01\iso\
And we wait again:
Thanks for sharing the tips Meneer Arne 🙂
Thanks for sharing. It works great. One BIG thing is the upload speed is approx. 30 times slower than download speed. Do you know why?
Duketin.