PowerShell script exchange
Post Reply
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Creating a backup job for a template

Post by Amerloc » Mar 08, 2012 2:18 pm

I'm using the same command for creating backup jobs for VMs and templates:

Code: Select all

Add-VBRBackupJob -Name "JobName" -Type "NET" -Server $server -Folder "DestinationFolder" -Filename "Filename" -Objects "Template_or_VM"
When the object is a VM the job is created correctly, but when the object is a template, the job is created but the object is not added, I have to add it manually using th GUI.

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Creating a backup job for a template

Post by ThomasMc » Mar 14, 2012 8:21 pm

pass it the object instead of using a string via the Find-VBRObject as its more reliable this way

Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: Creating a backup job for a template

Post by Amerloc » Mar 21, 2012 1:36 pm

Hi Thomas. Thanks for your reply.
When I run Find-VBRObject, no template is shown on the list and therefore, if I try to store the object name in a variable (i.e.: $obj = Find-VBRObject -Server $server|where {$_.name -eq "Template_Name"}) nothing is stored. ¿Is there some parameter needed to find template objects?

jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

Re: Creating a backup job for a template

Post by jlsung » Mar 29, 2012 9:11 am

Hi,
You can use this :
Find-VBRObject $server | where {$_.IsTemplate}

Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: Creating a backup job for a template

Post by Amerloc » Apr 02, 2012 12:44 pm

Hi jlsung. Thank you for your help.
I have tried what you told but as "where {$_.IsTemplate}" is a filter for the "Find-VBRObject" and "Find-VBRObject" doesn't show any template, the "Find-VBRObject $server | where {$_.IsTemplate}" neither shows any template. :-(

jlsung
Influencer
Posts: 21
Liked: never
Joined: Sep 15, 2011 1:41 pm
Contact:

Re: Creating a backup job for a template

Post by jlsung » Apr 05, 2012 7:41 am

Hi,

I tried again Find-VBRObject $vcenter | where {$_.IsTemplate} and it shows only template in my vcenter :roll:

ThomasMc
Expert
Posts: 293
Liked: 17 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Creating a backup job for a template

Post by ThomasMc » Apr 13, 2012 4:56 pm 1 person likes this post

jlsung wrote:Hi,

I tried again Find-VBRObject $vcenter | where {$_.IsTemplate} and it shows only template in my vcenter :roll:
Same as above

Code: Select all

PS C:\Users\administrator.VPOWERCLI> Find-VBRObject -server $server | ?{$_.IsTemplate}

Name                      MemoryInMB PowerState     IsTemplate Ref
----                      ---------- ----------     ---------- ---
LAB Template DC           2048       PoweredOff     True       vm-83

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests