PowerShell script exchange
Post Reply
d3nz
Expert
Posts: 130
Liked: 14 times
Joined: Mar 20, 2018 12:47 pm
Contact:

Getting Cloud Director organizations which Backup Jobs ends with error quota has been exceeded and send results to email

Post by d3nz »

Hello.
Have anybody script for getting Cloud Director organizations which Backup Jobs ends with error: "Error: Backup repository quota has been exceeded" and sending results to particular e-mail?
Or help me please to get this script.
Thank you!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting Cloud Director organizations which Backup Jobs ends with error quota has been exceeded and send results to e

Post by oleg.feoktistov » 1 person likes this post

Hi,

Provided that this error can be seen in a job log on a tenant's side, you could use this script to access such organizations:

Code: Select all

$cloudsessions = [Veeam.Backup.Core.CCloudSession]::GetAll() | where {$_.CloudType -eq 'Backup'}
foreach ($session in $cloudsessions) {
  $errorMessage = 'Backup repository quota has been exceeded'
  $logMessage = $session.Logger.GetLog().UpdatedRecords.Title
  if ($logMessage -match $errorMessage) {
    $session | select Tenant, @{n='QuotaExceeded';e={$True}}
  }
  else {
    $session | select Tenant, @{n='QuotaExceeded';e={$False}}
  }
}
I'm not sure about the message though. In my lab on tenant's side it states 'Not enough space on disk'.

Thanks,
Oleg
d3nz
Expert
Posts: 130
Liked: 14 times
Joined: Mar 20, 2018 12:47 pm
Contact:

Re: Getting Cloud Director organizations which Backup Jobs ends with error quota has been exceeded and send results to e

Post by d3nz »

Thanks Oleg.
But first string doesn't work correctly:

Code: Select all

Welcome to the Veeam Backup and Replication PowerShell Toolkit!

To list available commands, type Get-VBRCommand
To open online documentation on all available commands, type Get-VBRToolkitDocumentation

© Veeam Software Group GmbH. All rights reserved.

PS C:\Users\user> $cloudsessions = [Veeam.Backup.Core.CCloudSession]::GetAll() | where {$_.CloudType -eq 'Backup'}
Exception calling "GetAll" with "0" argument(s): "Requested registry access is not allowed."
At line:1 char:1
+ $cloudsessions = [Veeam.Backup.Core.CCloudSession]::GetAll() | where  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SecurityException

PS C:\Users\user> foreach ($session in $cloudsessions) {
>>   $errorMessage = 'Backup repository quota has been exceeded'
>>   $logMessage = $session.Logger.GetLog().UpdatedRecords.Title
>>   if ($logMessage -match $errorMessage) {
>>     $session | select Tenant, @{n='QuotaExceeded';e={$True}}
>>   }
>>   else {
>>     $session | select Tenant, @{n='QuotaExceeded';e={$False}}
>>   }
>> }
PS C:\Users\user>
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting Cloud Director organizations which Backup Jobs ends with error quota has been exceeded and send results to e

Post by oleg.feoktistov »

Looks like this method requires elevated access for some reason. Does the user account you are opening Powershell under have access permissions for HKLM:\Software\Veeam\Veeam Backup and Replication ? If it does, could you please try to run any other Veeam powershell cmdlet like Get-VBRServer and then the method above again? Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests