How to backup VMWare ESXi datastores using PowerShell

Home > Search > How-to
  by

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

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments