Veeam Backup PowerShell Script

PowerShell script exchange

Veeam Backup PowerShell Script

Veeam Logoby gestenta » Wed Sep 28, 2011 1:16 pm

Hello all.

I am new to the group and also the world of PowerShell. After exploring the powershell commands for Veeam, I would like to set up a script that backs up the VM's then shuts down the guests, and eventually the host.

First off, what's the best approach for this? I would imagine the PowerShell commands should work for the backup process. The rest may need to be another type of script.

Any direction or starting points would be much appreciated.

Thanks,
Geoff
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby Gostev » Wed Sep 28, 2011 1:48 pm

Hi Geoffrey, based on your description this task has very littly to deal with Veeam PowerShell snap-in, instead you should be using VMware PowerCLI for most of these task, as they are VMware related. The only Veeam command you will need in your script is single cmdlet starting the backup job containing the required VMs. You can find some examples for this cmdlet on these forums (search for Start VBRJob). Thanks.
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Mon Oct 10, 2011 2:23 pm

OK....thanks for the help. I was able to create the job within the Veeam GUI and am now trying to invoke it via powershell using the start-vbrjob command. I am running into an error when trying to call the job by name from the command line.
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby Gostev » Mon Oct 10, 2011 2:41 pm

Please do not post log snippets on forums, as requested when you click New Topic. For technical issues requiring logs investigation, please contact our support directly. Thanks!
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Mon Oct 17, 2011 2:36 pm

I was able to get the backup job to kick off and finish successfully, then shut down. My question is, does a Verify option exist to display the status of the backup as sucessful?

Thanks,
Geoff
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby foggy » Mon Oct 17, 2011 2:54 pm

You can use this script to monitor current job status. You can also use job HTML reports available in UI and by e-mail. Thanks.
foggy
Veeam Software
 
Posts: 14765
Liked: 1083 times
Joined: Mon Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Mon Oct 17, 2011 7:50 pm

Works beautifully. Anything which requires a network connection is not an option because the environment is classified.

Thanks for the replies.
Geoff
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Wed Oct 19, 2011 2:33 pm

I do have one follow up wish for this script which I think is pretty simple. I have added a status check to write back to the host.

My next step is to add an If statement of some kind to send a message for each outcome for example; Failed: "Your backup was not successful. Please contact IT for remediation."

Is this possible?

THanks,
Geoff
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Wed Oct 19, 2011 6:28 pm

Got this working as well with a simple If statement and write back to host, followed by "Press any key to continue..."

The only remaining action I would like, is to shutdown the VMHost from the script. Not having much luck with that as of yet.
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta

Re: Veeam Backup PowerShell Script

Veeam Logoby Vitaliy S. » Wed Oct 19, 2011 9:06 pm

Hi Geoffrey,

Here are two examples of how to use the PowerCli script to shutdown VM guest, please have a look:
http://www.virtu-al.net/2010/01/06/powe ... structure/
http://www.vmware.com/support/developer ... Guest.html

Out of curiosity...why do you need to shutdown VM guest after the backup?

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

Re: Veeam Backup PowerShell Script

Veeam Logoby gestenta » Thu Oct 20, 2011 2:24 pm

Thanks! Got it working.

-Geoff
gestenta
Novice
 
Posts: 8
Liked: never
Joined: Tue Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests