A few helpful Veeam Powershell commands I use often.


Userlevel 7
Badge +8

Finding Indexed Jobs

When many users start with Veeam, they turn indexing on for everything not understanding what it does or that it requires Enterprise Manager. The environment I inherited had this exact issue.  I have modified the jobs that the file servers are still indexed for quick search/restore but here is a handy little PS command to find all of the jobs using indexing on your Veeam Server.

 

Script

 

Get-VBRJob | where {$_.GetVSSOptions().WinGuestFSIndexingOptions.IsIndexingRequired -eq $True}

 

 

 

Listing all VM backup sizes

Another helpful PS script is to get the size of all of the VM backups. I often want to know which VM’s are taking up the most room, and having a total of the VBK’s and VIB’s without doing math on 30+ incrementals.

This will gather all the required info and can be exported if needed. If you have multiple repositories the jobs may show up more than 1 time as there will be a separate entry for each repo.  It’s still a great way to charge back to the VM owners. 

 

 

 

Script

 

$backups = Get-VBRBackup
$objectChains = @()

foreach($b in $backups){
    $rps = Get-VBRRestorePoint -Backup $b
    $objects = $b.GetObjects()

    foreach ($object in $objects) {
        $objectRps = $rps | where {$_.ObjectId -eq $object.Id}
        $backupSize = 0
        foreach ($objectRp in $objectRps) {
        $storage = $objectRp.FindStorage()
        $sizeRounded = [Math]::Round($storage.Stats.BackupSize/1GB, 2)
        $backupSize += $sizeRounded
        }
        $objectChains += $object | select DisplayName, @{n='BackupSizeGB';e={$backupSize}}

    }
}
$objectChains

 

 

 


12 comments

Userlevel 7
Badge +20

Thanks for sharing. Always great to see scripts and PS stuff. 

Userlevel 5
Badge +2

Great stuff! In fact, I started PS coding to solve similar challenges some time ago, and this code has evolved over time to retrieve many more “restore point statistics”, as I’ve called it.

You can find it here on VeeamHub.

Userlevel 7
Badge +13

Great stuff @Scott, next time I suggest you to use “Code” , in the meatballs menu (last icons on right).

I swear, that name exists!
 

 

Userlevel 7
Badge +17

Great stuff @Scott, next time I suggest you to use “Code” , in the meatballs menu (last icons on right).

I swear, that name exists!
 

 

Ok, I did not know the last 4 names up to now… 😎 And again something new learned today.

Userlevel 7
Badge +8

HAHA, thanks. I’ve used hamburger menu’s before but the meatballs one is new! 

 

This is great!

Userlevel 7
Badge +7

Thanks @Scott I’ve been using PowerShell more and more and these will be really useful. 

 

@marcofabbri I always did wonder if they had a name and now I know. Don’t think I have come across the Doner Menu yet!

Userlevel 7
Badge +8

Happy to help.  There are some REALLY smart guys in the R&D forums that helped me out with some PowerShell stuff too. 

 

I have a few more I'll post as clean them up a bit.   As someone who avoided scripting for a long time it makes life so much better once you learn it. 

Userlevel 7
Badge +7

Agree, scripting it one of those things that seems like a chore but once you get into it, it is a great skill to have on the toolbelt

Userlevel 7
Badge +20

Especially PowerShell as I use that daily for tasks and automation of things.  Hated it at first but once you get in to it then you are able to adapt scripts to create new ones, etc. 😎

Userlevel 7
Badge +8

Especially PowerShell as I use that daily for tasks and automation of things.  Hated it at first but once you get in to it then you are able to adapt scripts to create new ones, etc. 😎

I’m becoming an expert at modifying other peoples scripts 🤣.

 

My goal is to get to the point I can start with an idea and a blank canvas for full satisfaction. 

Userlevel 7
Badge +8

Thanks for sharing, love the second script. Already find a similar on the hub but but I can't find it 😅

Userlevel 7
Badge +8

Thanks for sharing, love the second script. Already find a similar on the hub but but I can't find it 😅

I found a similar one on the hub before, but it wasn’t quite as good at combining restore points I believe. There was a reason I modified and did something to this :).

 

It’s been a while now so I can’t remember 100%

Comment