PowerShell script exchange
Post Reply
slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Powershell script to backup VMs under vApp

Post by slimer » Jul 11, 2014 11:19 pm

Hi,

I would like to seek advise how to backup VMs under vApp or what command should I use to call all the VMs under vApp and get the script create a backup job automatically. I'm able to add the vApp using Gui, but i need to automate the creation of backup job using script.

Thank you. :)

slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Re: Powershell script to backup VMs under vApp

Post by slimer » Jul 12, 2014 6:32 am

Hi to All,

Just to make it simple, is there a way to get the VMs name under VirtualApplication group in a Folder?
Currently i'm using this script but not showing VMs under VApp.
Find-VBRObject -Server $VBRserverVC | ?{$_.VMFolder -eq "group-vxxx"} | Select Name

Thank you.

tsightler
VP, Product Management
Posts: 5448
Liked: 2263 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Powershell script to backup VMs under vApp

Post by tsightler » Jul 13, 2014 1:56 am

As it says when you run it, Find-VBRObject is obsolete and has been for some time. Instead you should be using Find-VBRViEntity which is capable of finding vCenter objects including vApps which you can then add to the job with Add-VBRViJobObject something like this:

Code: Select all

Find-VBRViEntity -Name "<vApp_Name>" | Add-VBRViJobObject -Job "<Job_Name>"
If however, you'd rather just add the VMs from the vApp to the job as individual VMs you could do something like:

Code: Select all

$vapp = Find-VBRViEntity -Name "<vApp_Name>"
Find-VBRViEntity | ?{$_.Path -like ($vapp.Path + "\*")} | Add-VBRViJobObject -Job "<Job_Name>"

slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Re: Powershell script to backup VMs under vApp

Post by slimer » Jul 14, 2014 11:06 pm

Thanks Tom, I will try this one.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests