PowerShell script exchange
Geoffroi
Lurker
Posts: 2
Liked: 3 times
Joined: Mar 23, 2015 3:43 pm
Full Name: Geoffroi Genot
Contact:

Re: Script to Verify VM's are backed up?

Post by Geoffroi » Apr 21, 2015 1:43 pm

Hi Glamic,

Honestly I didn't tried to run on an other server. The issues is that VEEAM PowerCLI doesn't allow to remote connect to a VEEAM server like VMWARE PowerCLI.

See this topic : http://forums.veeam.com/powershell-f26/ ... t7443.html

As suggested in this topic, you could try to use

Code: Select all

Invoke-Command -ComputerName "VBR-01" -ScriptBlock "asnp VeeamPSSnapin; #some code, using semicolons instead of line breaks#"
To execute "Get-VBRBackupSession"

Unfortunately I'm not able to test because only my VEEAM host is in Windows

michaelryancook
Expert
Posts: 116
Liked: 14 times
Joined: Nov 26, 2013 6:13 pm
Full Name: Michael Cook
Contact:

Re: Script to Verify VM's are backed up?

Post by michaelryancook » May 01, 2015 8:04 pm

Hi Geoffroi. I am curious where your script gets $FullVM from as I don't see that anywhere else in your script or in vCheck.

michaelryancook
Expert
Posts: 116
Liked: 14 times
Joined: Nov 26, 2013 6:13 pm
Full Name: Michael Cook
Contact:

Re: Script to Verify VM's are backed up?

Post by michaelryancook » May 01, 2015 9:42 pm

Nvm, I had not run vCheck yet.

michaelryancook
Expert
Posts: 116
Liked: 14 times
Joined: Nov 26, 2013 6:13 pm
Full Name: Michael Cook
Contact:

Re: Script to Verify VM's are backed up?

Post by michaelryancook » May 14, 2015 8:05 pm

In the section below, shouldn't it be "$Result | where {$_.backed_up -eq $false}"?

As $VMObj.backed_up = $true when the VMs status is not equal to failed. Then the result is currently looking for when $_.backup_up = $true to display the unprotected VMs. When it shoudl be looking for $_.backed_up = $false to display unprotected VMs.

Code: Select all

# Find all successfully backed up VMs in selected sessions (i.e. VMs not ending in failure) and update status to "Protected"
foreach ($session in $vbrsessions) {
    foreach ($vm in ($session.gettasksessions() | Where-Object {$_.Status -ne "Failed"} | ForEach-Object { $_ | Select-object @{Name="VMname";Expression={$_.Name}}})) {
      $VMObj = $Result | where {$_.VMName -eq $vm.VMname }
      if ($VMObj){
         $VMObj.backed_up = $true
      }
    }
}

$Result | where {$_.backed_up -eq $true}

mobyzone
Lurker
Posts: 1
Liked: never
Joined: Jun 04, 2015 2:07 pm
Full Name: Dan
Contact:

[MERGED] : Powershell - Identify VM's not added to a Backup

Post by mobyzone » Jun 04, 2015 2:12 pm

Hi there,

Does anyone know if it is possible to do a scan on vCenter for all VM's and see if they are added into a backup job? Reason being we have around 300 VM's and we had an issue with one of the VM's that needed to be restored but it wasn't being backed up at all.

Is it possible using powershell that I can run a scheduled task daily?

Thanks

veremin
Product Manager
Posts: 16789
Liked: 1410 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to Verify VM's are backed up?

Post by veremin » Jun 04, 2015 2:43 pm

Hi, Dan,

Kindly, see the scripts provided in this topic; should be something you're looking for.

Thanks.

Brad.Morris
Enthusiast
Posts: 43
Liked: 2 times
Joined: Sep 01, 2014 10:29 pm
Full Name: Brad Morris
Location: Melbourne, Australia
Contact:

[MERGED] : How to list all backup points for a Guest

Post by Brad.Morris » Jan 18, 2016 9:35 pm

Hi there,

I would like to know how I can get a report of all the backup points for a particular server from all backup sources.

For example.
I have a server called Server1. I have several different backup jobs that have backed this server up over time. So if I go into Backups and search for Server1. I can see several jobs that have backed this server up. And each job might have several restore points.

What I would like to do is to be able to run a script that will report back to me a list of all the jobs and restore points in those jobs for this server.

Hope this makes sense.

Thanks,
Brad.

veremin
Product Manager
Posts: 16789
Liked: 1410 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to Verify VM's are backed up?

Post by veremin » Jan 19, 2016 10:54 am

Check either Protected VMs report available in Veeam ONE or one of the scripts provided above and see whether it meets your expectations. Thanks.

albertwt
Expert
Posts: 640
Liked: 20 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Script to Verify VM's are backed up?

Post by albertwt » May 18, 2017 1:07 pm

Gatoo wrote:Hi,

I tried the dev script and everything works perfect! No more errors. Exclusions are ok, colors ok.

Some adds possible :
- Sort the result in alphabetical order (A-Z)
- Mail sending
- Export to html

Congrats!
Which script was working ?
--
/* Veeam software enthusiast user & supporter ! */

battles
Service Provider
Posts: 31
Liked: 1 time
Joined: Apr 07, 2017 2:03 pm
Full Name: Battles
Contact:

[MERGED] Get list of VMs protected - by host

Post by battles » May 24, 2017 7:10 pm

Hello,

I'd like to get a quick list of VMs that are currently getting backed up with Veeam - split out by host since we have many hosts connected to the Veeam B&R server.

TIA

nielsengelen
Veeam Software
Posts: 2619
Liked: 539 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Get list of VMs protected - by host

Post by nielsengelen » May 24, 2017 9:08 pm

There are multiple posts about this subject already; have a look at post241577.html?hilit=vm%20backed%20up#p241577
VCP-DCV
Veeam Certified Architect (VMCA)
http://foonet.be

itlicenses
Lurker
Posts: 1
Liked: never
Joined: Oct 19, 2017 2:58 pm
Full Name: IT Licenses
Contact:

[MERGED] last backup result and date for a particular VM

Post by itlicenses » Oct 19, 2017 3:12 pm

Hi,

First of all, I'm quite new to Veean and Powershell. I've already been writing some PowerShell scripts and everthing seems to work fine, but I wanted to know if the following is possible.

I'd like to monitor the last backup status and date for individual hosts. In particular, we use zabbix to monitor our hosts, and it would be great if I could have a trigger that told me that a successful backup has not been made for a host for more than X days. Now, we don't have jobs per host, but per area and network.

So, in my way of thinking, I'd use zabbix to get the hostname and then, probably, use Get-VBRBackupSession to start looking for VM's inside the jobs listed there. Is that the correct approach? Would I be able to look for particular VM's and know if they were successful, had warnings or had errors? I read Get-VBRBackupSession is quite demanding to run, so perhaps, also, there's a more efficient way to get this information?

Thanks!

veremin
Product Manager
Posts: 16789
Liked: 1410 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to Verify VM's are backed up?

Post by veremin » Oct 19, 2017 7:27 pm

Kindly, check scripts provided above; should give you some thoughts on how to automate that.

Unfortunately, you wouldn't be able to avoid usage of Get-VBRBackupSession cmdlet (which indeed sometimes might work rather slow), but saving sessions to hash table and working with it afterwards should speed up the process.

Thanks.

drtalbert
Lurker
Posts: 1
Liked: never
Joined: Nov 10, 2017 11:51 pm
Contact:

[MERGED] Last successful

Post by drtalbert » Nov 11, 2017 12:17 am

I am trying to find a way in powershell to pull the date of the last successful backup. So if I have a backup that runs daily and the last three days it has failed I would like to know the last date that it succeeded. I was able to find the last status for the sessions but that just shows failed for the failing ones. Any help would be great!

Shestakov
Veeam Software
Posts: 6916
Liked: 700 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Script to Verify VM's are backed up?

Post by Shestakov » Nov 11, 2017 12:38 pm

Hi and welcome to the community!
Please review scripts provided above in the topic.
Thanks!

marius roma
Expert
Posts: 450
Liked: 5 times
Joined: Feb 01, 2012 12:04 pm
Full Name: Mario
Contact:

[MERGED] Listing all VMs processed by jobs

Post by marius roma » Mar 29, 2018 1:59 pm

I need to list all the VMs processed by all my backup jobs.
Is there any sample I can start from?
Please consider that many jobs are not configured to backup single VMs but folders instead.
I started from a simple code like:

Code: Select all

Asnp VeeamPSSnapin
Get-VBRJob -Name "My_job_name" | Get-VBRJobObject
When I run the code I get a list of the folders backed up, while I need a list of the VMs.
Is there anything better I can start from?
Regards
marius

Vitaliy S.
Product Manager
Posts: 22874
Liked: 1540 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Script to Verify VM's are backed up?

Post by Vitaliy S. » Mar 30, 2018 11:34 am

Hi Marius, If your goal is to know what VMs are protected (processed by a job) feel free to use script examples provided in this thread or take a look at Veeam ONE built-in functionality. Hope this helps!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests