PowerShell script exchange
Post Reply
andershh
Service Provider
Posts: 2
Liked: never
Joined: Oct 30, 2015 9:56 am
Contact:

PowerShell number of Protected VMs

Post by andershh »

Hello.

I wondered if there is a way to gather the number of VMs you currently have protected as in this screenshot below:

Image

Thanks in advance!

Best regards
Anders Hagen Hansen
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: PowerShell number of Protected VMs

Post by PTide » 1 person likes this post

Hi,

In your case (Cloud) VMs that have at least one restore point are considered to be protected, no matter how old that restore is. Hence all you need to do is get total list of retore points, select by VM names, get unique and count lines. Pleas try the following code and check if the number matches:

Code: Select all

(Get-VBRRestorePoint | select {$_.VmName} -uniq).Count
Btw, have you considered using Veeam ONE reports to get the statistics about your environment?

Thank you.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: PowerShell number of Protected VMs

Post by veremin »

Since we're talking here about Service Provider's site, I don't think that tenants restore points are reflected there, thus, Get-VBRRestorePoint would return either local restore points created by SP himself or nothing.

In order to achieve your goal, you should query CloudTenant entity or, more specifically, VMCount property:

Code: Select all

(Get-VBRCloudTenant).VMCount 
Thanks.
LeslieBNS9
Lurker
Posts: 2
Liked: never
Joined: Oct 14, 2014 2:29 pm
Full Name: Leslie B

Managed VMs Count

Post by LeslieBNS9 »

Anyone know how to get the "Managed VMs" count through PowerShelll?

I tried the below command from a previous post. But the counts are coming back different.

Code: Select all

(Get-VBRRestorePoint | select {$_.VmName} -uniq).Count
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Managed VMs Count

Post by PTide »

Hi,

May I ask you what were the numbers it returned/you expected?

Thanks
LeslieBNS9
Lurker
Posts: 2
Liked: never
Joined: Oct 14, 2014 2:29 pm
Full Name: Leslie B

Re: Managed VMs Count

Post by LeslieBNS9 »

Here's what I'm looking for... Image

With this command I'm getting 609.

Code: Select all

(Get-VBRRestorePoint | select {$_.VmName} -uniq).Count
I added a filter for IsLicensed and I'm getting 562 with this command.

Code: Select all

(Get-VBRRestorePoint | Where {$_.IsLicensed -eq $true}  | select {$_.Name} -uniq).Count
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: PowerShell number of Protected VMs

Post by veremin »

Aren't there any imported restore points among those listed? You can double check it, using the following one-liner:

Code: Select all

(Get-VBRRestorePoint | ?{($_.FindBackup().name) -notlike "*_imported*"}).count
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests