PowerShell script exchange
Post Reply
gestenta
Novice
Posts: 8
Liked: never
Joined: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Veeam Backup PowerShell Script

Post by gestenta »

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
Gostev
Chief Product Officer
Posts: 31814
Liked: 7302 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Veeam Backup PowerShell Script

Post by Gostev »

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.
gestenta
Novice
Posts: 8
Liked: never
Joined: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

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.
Gostev
Chief Product Officer
Posts: 31814
Liked: 7302 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Veeam Backup PowerShell Script

Post by Gostev »

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!
gestenta
Novice
Posts: 8
Liked: never
Joined: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

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
foggy
Veeam Software
Posts: 21139
Liked: 2141 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Veeam Backup PowerShell Script

Post by foggy »

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.
gestenta
Novice
Posts: 8
Liked: never
Joined: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

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: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

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: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

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.
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Veeam Backup PowerShell Script

Post by Vitaliy S. »

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!
gestenta
Novice
Posts: 8
Liked: never
Joined: Sep 27, 2011 8:51 pm
Full Name: Geoffrey Stenta
Contact:

Re: Veeam Backup PowerShell Script

Post by gestenta »

Thanks! Got it working.

-Geoff
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests