PowerShell script exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Getting Started and Code Examples

Post by Andreas Neufert » 3 people like this post

Hello everybody,

At this topic, you can find useful stuff and links to code examples for the Veeam Backup & Replications PowerShell SDK.


What this thread is:
- a starting point for Backup & Replication PowerShell beginners
- a link collection to interesting code examples
- it is an ongoing project. You will likely find old outdated code that will maybe not work anymore as the PowerShell SDK was changed. But at least even with those you have a start point were to ask for an updated version.

What this thread isn´t:
- it is not complete and up to date (by design)
- it has no official support (it´s a community project)
- This is not a support forum, don´t expect any fast answers to problems. You can open a support ticket under http://www.veeam.com/support and the support team answers fast based on your maintenance contract SLAs.
If you find interesting topics, code examples or blog entry’s please "Like" it and add a link in an answer to this thread. If you want to discuss something, please use the linked thread or open a new one. We will add it from time to time to the index.
The Community lives from its people and their content. Please add your ready built scripts in a new topic and propose it here (new answer).

Hint for v9 Support:
With v9 many of the older scripts will work without problems. Maybe you have to change small things like Veeam added at a point “VI” or Hv” to the commands to separate VMware and Hyper-V commands. If you find a not working script please ask for an update at the individual thread. If you want to use a script that is not marked with *v9* at our newest Version, please test it and add a comment at the related thread if it is working or not. Thank you in advance.

Support
GitHub
How to start
Starting Jobs
Creating/Editing Jobs
Failover/Restore/Recovery
Backup Infrastructure
Scripts for special VMs
Remote Powershell and external connectivity (VMware Orchestrator)
Reporting stuff
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

Support
Powershell support through Veeam support organization is limited to fixing bugs and problems for specific commands. So, if you have problems with your script or need help to start with PowerShell, please use this Forum.

Veeam (non official) GitHub
A community project dedicated to experimental apps, tools, scripts etc around Veeam. Link: GitHub
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

How to start
A good read is the
Veeam PowerShell Reference Guide *v9*
there you can find a list of all commands and Veeam powershell basics.
Also you can start with
Veeam Powershell Scripts - Beginners guide *UPDATE3* *v5-v9*
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

Backup Infrastructure

infrastructure deployment (Managed Server + Proxy)*v9*
Andys scripting corner - Show proxy / Set transport mode *v6/v6.1*


Andys scripting corner - Post job command remote repository *v6/v6.1*
vCenter powershell permissions check *v6/v6.1*
Create VBM From Scratch (external link) *v6/v6.1*

Post job script - Offload to existing tape backup Software - only if job is successfull *v6.5* with v7 there are native tape support and you can offload backups to a second destionation with "backup copy job", but it is still helpful if you still want to use your legacy backup tool for offloading veeam backup files to tape.

Find out the used Backup Job file system folder *v7*
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

Scripts for special VMs

HOWTO: Backing up vCenter host issues *v6.5 and earlier* not needed for v7 which can backup vCenter consistent without problems
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

Failover/Restore/Recovery

Failover/Failback/Failback commit *v7*

File Restore Example *v7*
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

placeholder
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

placeholder
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

placeholder
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

placeholder
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Code Examples and "How to start" *beta*

Post by Andreas Neufert »

placeholder
jcwuerfl
Enthusiast
Posts: 44
Liked: 4 times
Joined: Jun 29, 2011 8:26 pm
Full Name: James
Contact:

Re: Code Examples and "How to start" *beta*

Post by jcwuerfl » 2 people like this post

vCenter powershell permissions check : http://forums.veeam.com/viewtopic.php?f=26&t=10526 [AN] Coll stuff. Added to index ... Thank you!
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Hi everybody,

I added more links and the "Andys scripting corner - beginners guide".

CU Andy
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert » 1 person likes this post

Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

-Checked some codes that are linked on this thread for v6.5 compatibillity and added *6.5* to the links.
-Enhanced Ultimate start job script

Hint: Most of the 6.1 code will work fine with 6.5 If you run into trouble with 6.5 start C:\Program Files\Veeam\Backup and Replication\Install-VeeamToolkit.ps1 once in a PS Admin window once. This will solve most likely your Problem.
The only commands you need to be carefull are scheduling commands, because we changed the possibilities and checkboxes in v6.5 .
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Added a link in the powershell remoting section
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Added another link to powershell remoteing section
Post Job Script - Remote script without PS & ActiveDirectory *v5/v6/v6.1/v6.5/v7* NEW
Post Job Cmd - Run only if job ends with success / warning *v6.5* NEW
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Updated a non working link. If you find more please answer to this thread.
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Added a link at external connectivity section with an example for "selecting only the latest vbk file for non Veeam based backup to tape"... In this case it was HP DP.
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Updated Replica Failover/Failback/Failback commit Code and linked it here.
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Getting Started and Code Examples

Post by Andreas Neufert »

Started v8 update of the scripts. Check again in the next days (maybe weeks) for frequent updates of this section.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests