PowerShell script exchange
Post Reply
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

VMs in repository

Post by avaleksandrov »

Hello!
I searched the forum but didn't find any information.
I'm looking for a script that shows the following information:
It prompts you to select a repository, then it looks at what tasks are performed in this repository.
Displays a list of VMs and the number of backup points that fall into this repository.

I know that information can be obtained using the VSSP, but it is the script that is of interest
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

Hi @avaleksandrov!

I _think_ I get your idea on these, but let me show you a few items I wrote out for other requests and you can tell me if they meet your needs or not.

> Displays a list of VMs and the number of backup points that fall into this repository.
powershell-f26/list-vms-one-by-one-t85364.html#p478296

Can you tell me, is this basic framework what you're looking for in this request? I'm guessing the properties I added to the PSCustomObject aren't quite enough, but you can add/remove what you're wanting to add/remove.

Similarly, there's another script that works at the Storages† level that might help: post443044.html#p443044

The first script focuses on looping over all backups and polling for the Restore Point information and printing it; you can get Repository information on each of the Storages

Basically, I suppose you can do something like:

1. Get the Repository you want with Get-VBRBackupRepository and save it to some variable. Remember Scale-out Backup Repositories (SOBR) are special hierarchy objects, so if you want to check those, you need to do Get-VBRBackupRepository -Scaleout, adding the -Scaleout parameter.
2. Find the backups you're interested in by doing Get-VBRBackup | Where-Object {$_.RepositoryID -eq $Repo.ID} #Assume you saved the Repository from step 1 to $Repo
3. Do the rest of the scripts I wrote, adding/removing properties as you desire.

We can help a bit more, but let me know if we're on the right track to start with.

Notes:
† (Read: backup files on repo; for Veeam code stuff, think backup files (vbk, vib, vrb) when you see Storages capitalized like this)
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

Great, I tested the first script and I really liked it.

Only I would like it to display not all the points of the list. And I displayed exactly the total number of points, I think in my scenario it would be better
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

Glad that these were useful for you :)

And sure, edits are welcomed and encouraged :D the formatting of the output is something I usually hold off on, as I think most people just aren't sure how to get the data in the first place. So if the script is enough for you to edit what you need, then I'm glad it works. If you don't mind, please share your final script after your edits with the community.
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

strange behavior of the script.
If I run it on an unloaded VBR, it's very fast.
If loaded, then the recipe can be executed
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

Maybe you have a rationalization, how can I bring the script to my requirements?
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

Hi @avaleksandrov,

> If loaded, then the recipe can be executed

Do I understand right that on a loaded VBR server, the script takes too long to execute? Or it doesn't execute at all?

If it's about too long to execute, can you share more details like:

1. Total number of jobs
2. CPU/RAM available for VBR server and the SQL server hosting the Veeam Configuration Database
3. Is the Veeam Configuration Database on same server as VBR or a separate server?

If it doesn't execute at all, what is the error?
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

Runs straight for a very long time
1) 250 jobs
2) 32/64 for VBR and 24/48 for SQL
3) Separate server
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

Hrm, seems pretty normal stats; about how long does it take to execute?

The script as written loops over _all backups_, so that might be it. Also, what Microsoft SQL edition is in use? Or is it PostgreSQL?
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

microsoft sql 2019 enterprise
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

KK, and how long does the script take to execute? You can use Powershell Measure-Command cmdlet.
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

40 min (((
david.domask
Veeam Software
Posts: 2355
Liked: 556 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: VMs in repository

Post by david.domask »

Got it, sounds like we need to review what's happening with the DB; I suspect it's for some reason SQL performance, but the CPU/RAM look good, as does edition.

Can you open a support case and provide me with the case number here?

Include a copy of the Configuration Database: https://www.veeam.com/kb1471

Basically, my Engineers will load the database into our lab and try to reproduce it just first to check if it's something on the cmdlets; if we cannot reproduce the long times in lab, likely it's the SQL server performance. There are no known issues with the cmdlets in question, so I suspect it's mostly performance issue or maybe something not right in the DB, but probably performance.
David Domask | Product Management: Principal Analyst
avaleksandrov
Influencer
Posts: 12
Liked: 1 time
Joined: Oct 21, 2022 3:38 pm
Contact:

Re: VMs in repository

Post by avaleksandrov »

Case #06094217
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests