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 »

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
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Creating a backup job for a template

Post by ThomasMc »

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 »

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 »

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 »

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 »

Hi,

I tried again Find-VBRObject $vcenter | where {$_.IsTemplate} and it shows only template in my vcenter :roll:
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Creating a backup job for a template

Post by ThomasMc » 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: Majestic-12 [Bot] and 11 guests