Adding More than one Copy VM to a Application Group

PowerShell script exchange

Adding More than one Copy VM to a Application Group

Veeam Logoby TheMonk » Wed Jul 01, 2015 9:19 am

Hi There

Ive been in discussions on the following topic veeam-backup-replication-f2/add-a-backup-copy-job-in-the-surebackup-job-t21339-30.html

This is all about adding a copied VM to an application group for testing in a sandbox environment.

The reason for this is so I can replicate certain site to site connections etc.

I can get one VM into a application group but when using the provided code in that previous topic I can not get any more than one VM.

If I run
Code: Select all
$RestorePoints = @((Get-VBRRestorePoint -Name "Name of first VM" | sort creationtime | select -Last 1), (Get-VBRRestorePoint -Name "Name of second VM" | sort creationtime | select -Last 1))
Add-VSBViApplicationGroup –Name “AG” –RestorePoint $RestorePoints


That simply adds the second VM

if I run
Code: Select all
Get-VBRRestorePoint -Name "Name of first VM" | sort creationtime | select -Last 1

That gives me the first VM showing that at least I can see the restore point.

Many thanks for any help in advance
TheMonk
Influencer
 
Posts: 17
Liked: never
Joined: Wed Jun 17, 2015 3:03 pm
Full Name: Chris Armitage

Re: Adding More than one Copy VM to a Application Group

Veeam Logoby v.Eremin » Wed Jul 01, 2015 10:24 am

What product version you're using? And what happens if you input $RestorePoints variable into console, will both restore points be shown?
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Adding More than one Copy VM to a Application Group

Veeam Logoby TheMonk » Thu Jul 02, 2015 8:33 am

Im using version8 with the latest patch.

Interestingly now its placing the First VM into the Application group...no second one.

When I run $RestorePoints it simply shows me the one VM
TheMonk
Influencer
 
Posts: 17
Liked: never
Joined: Wed Jun 17, 2015 3:03 pm
Full Name: Chris Armitage

Re: Adding More than one Copy VM to a Application Group

Veeam Logoby v.Eremin » Thu Jul 02, 2015 9:47 am

That's what I suspected. That means that only one restore point out of two is gotten and then passed to application group. As the result, Application Group contains only one VM.

Try to divide the code into two portions and see which one doesn't work:

Code: Select all
$RestorePoint1 = Get-VBRRestorePoint -Name "Name of first VM" | sort creationtime | select -Last 1
$RestorePoint2 = Get-VBRRestorePoint -Name "Name of second VM" | sort creationtime | select -Last 1
$RestorePoint1
$RestorePoint2


If one of those doesn't show anything, try to disregard sorting portion and check whether at least something is returned for the said VM:

Code: Select all
Get-VBRRestorePoint -Name "Name of first or second VM"


Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Adding More than one Copy VM to a Application Group

Veeam Logoby TheMonk » Thu Jul 02, 2015 10:12 am

WTF

The following now works
Code: Select all
$RestorePoints = @((Get-VBRRestorePoint -Name "Name of first VM" | sort creationtime | select -Last 1), (Get-VBRRestorePoint -Name "Name of second VM" | sort creationtime | select -Last 1))
Add-VSBViApplicationGroup –Name “AG” –RestorePoint $RestorePoints


Only change is that the server has been rebooted.....it did a windows update? I wonder if Powershell was somehow stuck
TheMonk
Influencer
 
Posts: 17
Liked: never
Joined: Wed Jun 17, 2015 3:03 pm
Full Name: Chris Armitage

Re: Adding More than one Copy VM to a Application Group

Veeam Logoby v.Eremin » Thu Jul 02, 2015 10:32 am

Not sure what might have been wrong in your situation. May be prior to update PowerShell didn't operate as expected. By the way, isn't it PS 2.0 by any chance; this version typically has a lot of strange problems with missing parameters, etc.?

Anyway, I'm glad to hear that now everything works properly.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 2 guests