PowerShell script exchange
Post Reply
jhicks
Novice
Posts: 6
Liked: never
Joined: Dec 11, 2009 2:35 pm
Full Name: Jeffery Hicks
Contact:

Add-VBRBackupJob specify ESX server

Post by jhicks »

Alright I give. :cry: I've tried to make sense of the documentation and example for creating a new backup job but either I'm missing something or there is an element missing from the cmdlet. How do you specify which ESX server to connect to for backup? Whenever I try to setup a job, it tries to connect to an ESX server that is currently offline.

What I want to do is create a backup job that will go through all VMS in the store, DataStore2 from the server called ESX and back them up locally to G:\datastore2. This is the most recent version of my expression, which fails.

Add-VBRBackupJob -Name "Dstore2_Backup" -Type VDDK -mode san -Folder g:\datastore2 -objects DataStore2 -host "My Computer" -FileName g:\dstore2.vbk

I'm suspecting I have to set the right value for -objects but I'm not sure how.
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Add-VBRBackupJob specify ESX server

Post by Vitaliy S. »

Hello Jeffery,

You cannot choose a datastore as a container to backup VMs from. This feature will be delivered with v5. I'm not a great PowerShell expert, but I would recommend you to try using the following syntax. That should allow you to choose every VM located on the ESX.SERVER.LOCAL host:

Code: Select all

Add-VBRBackupJob -Name "Dstore2_Backup" -Type VDDK -mode san -Folder g:\datastore2 -objects ESX.SERVER.LOCAL -host "My Computer" -FileName g:\dstore2.vbk 
Additionally, please have a look at this topic which contains some useful information about using PowerShell. There you will also find a link to the script example created by one of our customers, which he posted in his blog - Powershell cmdlets

Hope it helps!
jhicks
Novice
Posts: 6
Liked: never
Joined: Dec 11, 2009 2:35 pm
Full Name: Jeffery Hicks
Contact:

Re: Add-VBRBackupJob specify ESX server

Post by jhicks »

I ended up removing my offline VM from the list. It didn't have any backups yet so it wasn't a big deal. Once that was done I was able to get the command to work. Allthough I also realized I was specifying the folder name and not the actual VM name for -object. But even so, it seems you need to be able to specify a server name because what happens if you happen to have VMs on different hosts that happen to have the same name?

Using PowerCLI and Veeam, I created my job like this:

$v=@()
get-vm -Datastore datastore2 | foreach {$v+=$_.name}
Add-VBRBackupJob -Name "Dstore2_Backup" -Type VDDK -mode san -Folder g:\datastore2 -objects $v -host "MyComputer" -FileName dstore2
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Add-VBRBackupJob specify ESX server

Post by Vitaliy S. »

In case you have VMs with the same name on different hosts, they will be both added to the job and processed using the unique moref ID.
Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests