Running a restore via PowerShell

PowerShell script exchange

Running a restore via PowerShell

Veeam Logoby vy68749p » Wed Jun 02, 2010 6:24 pm

Can someone post an example of a Set-VBRRestoreVM command?

We have several VMs in a backup file and we need to just create a script to run through and restore each one as the previous one finishes. I don't need anything fancy but I've looked at this off and on for days and I'm getting no where. Any help would be appreciated!

Thanks
vy68749p
Novice
 
Posts: 3
Liked: never
Joined: Tue Jan 26, 2010 7:10 pm
Full Name: Edwin Reed

Re: Running a restore via PowerShell

Veeam Logoby Vitaliy S. » Wed Jun 02, 2010 7:01 pm

Hello Edwin,

Let me check the proper usage of this cmdlet with devs, as I'm not great expert in Powershell. I will update this thread with the example tomorrow.

Thanks!
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Running a restore via PowerShell

Veeam Logoby Gostev » Wed Jun 02, 2010 7:34 pm

Hello Edwin, this is a script one of our customers created to automate VM recovery testing

The blog is in Russian, but Google Translate does a decent job, plus actual PowerShell code does not need translation ;)
http://translate.google.com/translate?h ... pot.com%2F

Hope this helps!
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Running a restore via PowerShell

Veeam Logoby vy68749p » Wed Jun 02, 2010 8:03 pm

Thanks, I'll download the code and take a look. I think part of the problem here is just my lack of knowledge with PowerShell. I got one of the other guys in the office here to help me out and we got it working for the most part. I do have one question left though and it may take a support person to answer this one...

When using Get-VBRJobRestorePoints, there is a date option...is there a command I can use for the date to always choose the latest backup? This is for our DR recovery and it would be nice to just be able to use -Date "latest" or something like that if that makes sense.
vy68749p
Novice
 
Posts: 3
Liked: never
Joined: Tue Jan 26, 2010 7:10 pm
Full Name: Edwin Reed

Re: Running a restore via PowerShell

Veeam Logoby Vitaliy S. » Thu Jun 03, 2010 8:17 am

Edwin,

To choose the latest date for your backups, you should be using this cmdlet:
Code: Select all
((Get-VBRJobRestorePoints "JobName" "VmName" | sort CreationTime)[0])

Also here is the Set-VBRRestoreVM cmdlet usage example as requested:
Code: Select all
Set-VBRRestoreVM ((Get-VBRJobRestorePoints "JobName" "VmName" | sort CreationTime)[0]) (Get-VBRJobDestination VcOrEsxName.domain.local "DatastoreName" "ResourcePoolName") -DiskType Source -VMName "NewVmName"

Hope it helps!
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Running a restore via PowerShell

Veeam Logoby vy68749p » Thu Jun 03, 2010 2:16 pm

Thanks so much! That's exactly what I was needing.
vy68749p
Novice
 
Posts: 3
Liked: never
Joined: Tue Jan 26, 2010 7:10 pm
Full Name: Edwin Reed

Re: Running a restore via PowerShell

Veeam Logoby alcidion » Fri Oct 07, 2011 7:32 am

The script doesn't appear to be at that site anymore.

Can you copy/paste it into the forum?

Adam
alcidion
Lurker
 
Posts: 1
Liked: never
Joined: Fri Oct 07, 2011 2:48 am
Full Name: Adam

Re: Running a restore via PowerShell

Veeam Logoby Vitaliy S. » Fri Oct 07, 2011 9:19 am

Hello Adam, here you go the scripts from the blog above. If you're searching for a script to restore VMs with Powershell, then please look through the example in my previous post, should help. Thanks!
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Running a restore via PowerShell

Veeam Logoby squestier » Thu Apr 12, 2012 10:02 am

hello,

How can we receive the result of the restore with Set-VBRRestoreVm (Success, Failed, Running...)

I cant't figure how to do that because there is no associated job created.

Regards.

Sebastien
squestier
Lurker
 
Posts: 2
Liked: never
Joined: Thu Apr 12, 2012 9:35 am
Full Name: Sebastien QUESTIER


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests