PowerShell script exchange
Post Reply
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Script Instant Recovery of 6 VM's

Post by Fizzer »

I have a sharepoint farm which we will need to restore items, lists libraries, sites and site collecitons from. It seems that the quickest way to get all 6 VM's (1xDC, 1xSQL, 4xSharepoint) up and running on an isolated network is to use instant recovery. Because I can't set up an instant recovery 'job' in the UI (new feature please! :D ) I'll need to script it.

So what I need is a script that will prompt for the restore point, then start all 6 from that point in an isolated environment. Then I guess it would be handy if we could mount a 'helper' datastore to one of the VM's so data could be copied back to the live environment.

I hope this is enough info, if anyone could help with this I'd be very grateful!
Cheers
Andy
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Script Instant Recovery of 6 VM's

Post by ThomasMc »

Sounds easy enough, let me have a poke about and I'll get back to you, v6 I assume?
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Script Instant Recovery of 6 VM's

Post by ThomasMc »

on having another ponder, wouldn't using a surebackup job to spin up all 6 and then mounting a disk to one of them be a better option? scripted of course :)
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Fizzer »

I have tried surebackup, there are a few issues with being able to communicate with the guests and confirm their roles. I'm going to raise a support case for that seperately, however even if that did work it seems that the surebackup job starts all the VM's in sequence, I really need to mount all the VM's as fast as possible.
I've had a fiddle but it's not working (yet)

$rp = Get-VBRRestorePoint -Backup ((Get-VBRBackup)[2])
$server = Get-VBRServer | where {$_.Name -eq "servername"}
$res = Find-VBRResourcePool -server $server
Start-VBRInstantRecovery -RestorePoint $rp -Server $server -ResourcePool $res

Any hints?

Thanks
Andy
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Script Instant Recovery of 6 VM's

Post by ThomasMc » 1 person likes this post

Haven't tested but this should be more what your after

Code: Select all

#Job name
jobName = "LAB - DC AA"

#VM name
$vmName = "vm.vPowerCLI.Local"

#Get the server you'll be using
$irRestoreServer = Get-VBRServer -Name "DestServer"

#Resource Pool
$irRestoreRP = Find-VBRResourcePool -Server $irRestoreServer -Name "Resources"

#Get the lastest restore point
$irRestorePoint = Get-VBRBackup -Name $jobName | Get-VBRRestorePoint -Name $vmName | Sort CreationTime -Descending | Select -First 1

#Fire the Instant restore job
Start-VBRInstantRecovery -VMName $("IR-" + $vmName) -Server $irRestoreServer -ResourcePool $irRestoreRP -PowerUp:$false -NICsEnabled:$false -Reason "vPowerCLI test IR" -RunAsync
you'll then have to use PowerCLI to change the VM onto your isolated network, connect the NICs, create and mount a disk and powerup, still think SB would be faster and you can fire more than one VM at a time with it also
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Fizzer »

Thanks for the help so far Thomas, I'm curious, how can you start more than one at a time with surebackup?
My experience so far is that SB will start each VM in turn.
Gostev
Chief Product Officer
Posts: 31814
Liked: 7302 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Gostev »

All VMs included in the Application Group are started at once (taking into account the required boot delay, of course).
All VMs from linked backup job with be started X at a time (where X is configurable, 3 by default).
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Fizzer »

I think I'm missing something obvious, This is the description of the Application Group from the UI:
"Application Group defines your application dependancies by specifying the boot order of required VMs. Any application group typically includes at least a domain controller, DNS and DHCP server."

In the properties of the application group I can't find anywhere that allows me to boot multiple VMs - just the boot order...

Thanks for the help so far folks, sorry for the endless questions...

Andy
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Fizzer »

Ahh, I found what you were referring to.
I was using 'application Group' not 'Backup Jobs' tab to define which servers to boot. The 'Backup Jobs' tab has the option to power on VMs simulataniousy.

Thanks for the help.
Fizzer
Enthusiast
Posts: 38
Liked: never
Joined: Apr 22, 2012 1:36 pm
Full Name: Andy Braithwaite
Contact:

Re: Script Instant Recovery of 6 VM's

Post by Fizzer »

It looks like the limitation with using the above is that the VM's are powered off immediately after successful boot.
It looks like I have three options:
a) powershell boot of all 6 VM's, followed by config changes (powercli)
b) Surebackup - use 'application group' - boot all VM's in order
c) Surebackup - use 'Backup Jobs' - boot all VM's simultaniously

Unless I've understood the functionality incorrectly:
a) is a problem because I want to be able to devolve the ability to restore sharepoint to the sharepoint admins, this might be a tad too complicated for them
b) takes a long time while you wait for each VM to boot
c) boots quickly but then shuts down each Vm immediately after a successful boot

I kinda need all VM's to boot at once, ignore all checking (if possible) and stay up until shut down.

I fear that this is going off topic (powershell) slightly, sorry for that!

Thanks again.

Andy
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests