VMWare - Backup ESXi datastores using PowerShell

by
Jeremy Canfield |
Updated: March 09 2020
| VMWare articles
First, determine the full path to each of your datastores:
Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin VMware.VumAutomation
Connect-VIServer -Server server_name -User username -Password password
Get-DataStore datastore_name
This should produce an output with a few lines of output. Make note of the line of output with the DatastoreBrowserPath:
DatastoreBrowserPath : vmstores:\server_name@443\ha-datacenter\datastore_name
Use this script to backup the datastore, using the DatastoreBrowserPath:
Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin VMware.VumAutomation
Connect-VIServer -Server server_name -User username -Password password
Copy-DatastoreItem -Item vmstores:\server_name@443\ha-datacenter\datastore_name\* -Destination C:/Temp/ -Recurse
Disconnect-VIServer -Server server_name
Did you find this article helpful?
If so, consider buying me a coffee over at