PowerShell script exchange
Post Reply
Palmero
Influencer
Posts: 12
Liked: 1 time
Joined: Jul 12, 2021 6:30 pm
Full Name: Juan Palmero
Contact:

v12 Method No Longer Works

Post by Palmero »

Hello,

Just upgraded from v11 to 12. Then found out my PS script throwing errors. Here is the script:

Code: Select all

$Repos     = Get-VBRObjectStorageRepository -Type AmazonS3Compatible
$Repos | ForEach-Object {
        $UsedKB  = [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($_.Id)
        $UsedTB += [Math]::Round([float]($UsedKB/1TB),2)
    }
This worked under 11, but now I get:

Method invocation failed because [Veeam.Backup.Core.CBackupRepository] does not contain a method named 'CalcArchiveRepositoryUsedSizeByIndices'.
At line:5 char:9
+ $UsedKB = [Veeam.Backup.Core.CBackupRepository]::CalcArchive ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound


Any suggestions or reference to documentation appreciated.

Thank you.
Mildur
Product Manager
Posts: 9830
Liked: 2599 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: v12 Method No Longer Works

Post by Mildur »

Hi Juan

Those methods were unsupported and may not work in a new version.
Therefore we don't have a public documentation about it. I'll forward this topic to my colleague. Maybe he can help with a new method working in V12.

Best,
Fabian
Product Management Analyst @ Veeam Software
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: v12 Method No Longer Works

Post by oleg.feoktistov »

Hi Juan,

It looks like this method was deleted in v12. Try these ones instead:

Code: Select all

$repo = Get-VBRObjectStorageRepository -Type AmazonS3Compatible
$usedTotal = [Veeam.Backup.Core.CArchiveRepository]::GetTotalUsedSize($repo.Id)
$usedIndices = [Veeam.Backup.Core.CArchiveRepository]::GetUsedSizeByIndices($repo.Id)
Best regards,
Oleg
Palmero
Influencer
Posts: 12
Liked: 1 time
Joined: Jul 12, 2021 6:30 pm
Full Name: Juan Palmero
Contact:

Re: v12 Method No Longer Works

Post by Palmero »

Hi Oleg,

That seems to work. Thank you.

Where are you getting these from? Is there any documentation I can refer to for future reference?

Again, thanks.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: v12 Method No Longer Works

Post by oleg.feoktistov »

Hi Juan,

Usually I get these by digging source code or searching through imported .NET assemblies our powershell module relies on.
These methods are not documented, unfortunately, as we cannot provide documentation for what's not supported and can be used only as a workaround.

Best regards,
Oleg
riley.martin
Lurker
Posts: 2
Liked: never
Joined: Oct 18, 2022 8:14 pm
Full Name: Riley Martin
Contact:

Re: v12 Method No Longer Works

Post by riley.martin »

oleg.feoktistov wrote: Apr 12, 2023 11:56 am $usedTotal = [Veeam.Backup.Core.CArchiveRepository]::GetTotalUzedSize($repo.Id)
$usedIndices = [Veeam.Backup.Core.CArchiveRepository]::GetUzedSizeByIndices($repo.Id)
[/code]
It appears there is a typo in the word "used" on these function calls. Besides that, they seem to work as intended.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: v12 Method No Longer Works

Post by oleg.feoktistov »

Thank you for pointing it out! Fixed the typos.
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 19 guests