PowerShell script exchange
Post Reply
darren.flatman
Influencer
Posts: 15
Liked: 2 times
Joined: Mar 02, 2022 10:07 am
Full Name: Darren Flatman
Contact:

Get total + used space for Veeam repository

Post by darren.flatman »

Hello,

I want to create a script that generates an alert when a repository is below 10% free space.

The command Get-VBRBackupRepository is the only cmd that I can find that would get this info but it does not include "capacity" and "free" properties.

Anyone had this problem before or know if there is an alternative to Get-VBRBackupRepository?

Seems to have everything else -
Info :
Host :
Id :
Name :
HostId :
MountHostId :
Description :
CreationTime :
Path :
FullPath :
FriendlyPath :
ShareCredsId :
Type :
Status :
IsUnavailable :
Group :
UseNfsOnMountHost :
VersionOfCreation :
Tag :
IsTemporary :
TypeDisplay :
IsRotatedDriveRepository :
EndPointCryptoKeyId :
CryptoKeyId :
Options :
HasBackupChainLengthLimitation :
IsSanSnapshotOnly :
IsDedupStorage :
SplitStoragesPerVm :
IsImmutabilitySupported :
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get total + used space for Veeam repository

Post by oleg.feoktistov »

Hi Darren,

Before v11 these properties were contained in CBackupRepository.Info property. In v11 we introduced some underlying changes, so these properties were moved to CRepositoryContainer class. You can find the detailes here. For object storages it gets a bit tricky, I'd advise to check this post.

Please note that all the solutions in the referenced topics are considered as workarounds and are not supported.

Thanks,
Oleg
darren.flatman
Influencer
Posts: 15
Liked: 2 times
Joined: Mar 02, 2022 10:07 am
Full Name: Darren Flatman
Contact:

Re: Get total + used space for Veeam repository

Post by darren.flatman » 1 person likes this post

Thanks I got the info from a reply on that thread

the script I am using is -

Code: Select all

$Repos = get-vbrbackuprepository
$RepoDetails = foreach ($repo in $Repos) {
   
        $Name      = $Repo.Name
        $ID        = $Repo.ID
        $Size      = $Repo.GetContainer().CachedTotalSpace.InBytes / 1GB
        $FreeSpace = $Repo.GetContainer().CachedFreeSpace.InBytes / 1GB
        $10 = $Size * 0.1
    if ($FreeSpace -le $10)

     {
     write-host "<-Start Result->"
     write-host $Name "Warning 10% storage remaining"
     write-host "<-End Result->"
     exit 1
     }

     else

     {
     write-host "<-Start Result->"
     write-host "Storage good"
     write-host "<-End Result->"
     exit 0
     }


    }
  
Its for our RMM tool to raise a ticket if the repo has less than 10%, if anyone reading this wants to use should work
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests